错误域= NSURLErrorDomain代码= -1005“网络连接丢失。” [英] Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost."

查看:2160
本文介绍了错误域= NSURLErrorDomain代码= -1005“网络连接丢失。”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个适用于iOS7和iOS8的Xcode6-Beta1和Xcode6-Beta2的应用程序。但是对于Xcode6-Beta3,Beta4,Beta5,我面临iOS8的网络问题,但iOS7上的一切正常。我收到错误网络连接丢失。。错误如下:

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 everything works fine on iOS7. I get the error "The network connection was lost.". The error is as follows:


错误:错误域= NSURLErrorDomain代码= -1005网络连接丢失。 UserInfo = 0x7ba8e5b0 {NSErrorFailingURLStringKey =,_ kCFStreamErrorCodeKey = 57,NSErrorFailingURLKey =,NSLocalizedDescription =网络连接丢失。,_ kCFStreamErrorDomainKey = 1,NSUnderlyingError = 0x7a6957e0网络连接丢失。}

Error: Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo=0x7ba8e5b0 {NSErrorFailingURLStringKey=, _kCFStreamErrorCodeKey=57, NSErrorFailingURLKey=, NSLocalizedDescription=The network connection was lost., _kCFStreamErrorDomainKey=1, NSUnderlyingError=0x7a6957e0 "The network connection was lost."}

我使用AFNetworking 2.x和以下代码片段进行网络通话:

I use AFNetworking 2.x and the following code snippet to make the network call:

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager setSecurityPolicy:policy];
manager.requestSerializer = [AFHTTPRequestSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];

[manager POST:<example-url>
   parameters:<parameteres>
      success:^(AFHTTPRequestOperation *operation, id responseObject) {
          NSLog(@"Success: %@", responseObject);
      } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
          NSLog(@"Error: %@", error);
      }];

我尝试了 NSURLSession ,但仍然收到同样的错误。

I tried NSURLSession but still receive the same error.

推荐答案

重新启动模拟器为我解决了这个问题。

Restarting the simulator fixed the issue for me.

这篇关于错误域= NSURLErrorDomain代码= -1005“网络连接丢失。”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆