错误域= 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.