目标C:“网络连接丢失。”问题
目前我正在做一个项目,其中设备需要与Mac机器进行通信。当设备连接到 Mac 时,HTTP 请求将发送到设备,该请求将由设备上的 CGI 应用程序处理。
为此,我创建了一个 NSURLConnection 实例,它将向给定的 CGI 链接发送请求。
但是,没有收到设备应发送的响应。相反,将调用 connection:didFailWithError 方法。打印的错误如下:
错误域=NSURLErrorDomain代码=-1005 UserInfo=0x114c76230“网络连接丢失。”底层错误=(错误域=kCFErrorDomainCFNetwork代码=-1005 UserInfo=0x114c79160“网络连接丢失。”)
可能是什么问题?
我已经检查了设备的界面是否显示在Mac上的系统首选项>中。网络。当使用 Wget 执行 shell 脚本时,我能够得到响应。有什么方法可以以编程方式检查特定的连接性吗?
Currently I am working on a project in which a device needs to be communicated with a Mac machine. When the device is connected to the Mac, an HTTP request will be sent to the device which will be handled by a CGI application on the device.
For that, I have created an NSURLConnection instance, which will send a request to the given CGI link.
But, the response which is supposed to be sent by the device is not received. Instead connection:didFailWithError method gets invoked. The error printed was as follows :
Error Domain=NSURLErrorDomain Code=-1005 UserInfo=0x114c76230 "The network connection was lost." Underlying Error=(Error Domain=kCFErrorDomainCFNetwork Code=-1005 UserInfo=0x114c79160 "The network connection was lost.")
What could be the problem?
I have checked the interface for the device is shown on the mac in the system preferences > network. When a shell script is executed using Wget, then i was able to get the response. Is there any way to check programmatically for particular connectivity?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查您的设备网络连接后,我认为这可能是 wi-fi 问题。我不确定您是否可以使用可达性类别来解决此问题
i think it may be wi-fi problem once check your device network connectivity.i am not sure You can use reachability class for this issue