Error Domain=NSURLErrorDomain Code=-1005 “The network connection was lost.”

前端 未结 30 2974
悲哀的现实
悲哀的现实 2020-11-22 05:51

I have an application which works fine on Xcode6-Beta1 and Xcode6-Beta2 with both iOS7 and iOS8. But with Xcode6-Beta3, Beta4, Beta5 I\'m facing network issues with iOS8 but

相关标签:
30条回答
  • 2020-11-22 06:50

    Restarting the simulator fixed the issue for me.

    0 讨论(0)
  • 2020-11-22 06:50

    For mine, Resetting content and settings of Simulator works. To reset the simulator follow the steps:

    iOS Simulator -> Reset Content and Settings -> Press Reset (on the warning which will come)

    0 讨论(0)
  • 2020-11-22 06:50

    The iOS 8.0 simulator runtime has a bug whereby if your network configuration changes while the simulated device is booted, higher level APIs (eg: CFNetwork) in the simulated runtime will think that it has lost network connectivity. Currently, the advised workaround is to simply reboot the simulated device when your network configuration changes.

    If you are impacted by this issue, please file additional duplicate radars at http://bugreport.apple.com to get it increased priority.

    If you see this issue without having changed network configurations, then that is not a known bug, and you should definitely file a radar, indicating that the issue is not the known network-configuration-changed bug.

    0 讨论(0)
  • 2020-11-22 06:51

    I was hitting this error when passing an NSURLRequest to an NSURLSession without setting the request's HTTPMethod.

    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:urlComponents.URL];
    

    Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost."

    Add the HTTPMethod, though, and the connection works fine

    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:urlComponents.URL];
    [request setHTTPMethod:@"PUT"];
    
    0 讨论(0)
  • 2020-11-22 06:52

    what solved the problem for me was to restart simulator ,and reset content and settings.

    0 讨论(0)
  • 2020-11-22 06:52

    Got the issue for months, and finally discovered that when we disable DNSSEC on our api domain, everything was ok :simple_smile:

    0 讨论(0)
提交回复
热议问题