开发者

Objective C : "The network connection was lost." Issue

开发者 https://www.devze.com 2023-02-27 10:32 出处:网络
Currently I am working on a project in which a device needs to be communicated with a Mac machine. W开发者_JAVA百科hen the device is connected to the Mac, an HTTP request will be sent to the device wh

Currently I am working on a project in which a device needs to be communicated with a Mac machine. W开发者_JAVA百科hen 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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消