Aviru
Aviru

Reputation: 109

NSURLErrorDomain Code=-1005 "The network connection was lost.", _kCFStreamErrorCodeKey=54

Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=54, NSUnderlyingError=0x2834c47b0 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={_kCFStreamErrorCodeKey=54, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask .<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask .<1>" ), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://xxx.xxxx.com/xxxx/xxxxx, NSErrorFailingURLKey=https://xxx.xxxx.com/xxx/xxx, _kCFStreamErrorDomainKey=1} [-1005]

Got above error When I am firing api using AFNetworking. I have configured "App Transport Security setting" to allow arbitrary loads. Increased timeout interval of AFNetworking request serializer to 100 seconds. But none helped.

Upvotes: 1

Views: 6174

Answers (1)

BhargavR
BhargavR

Reputation: 1133

If you are testing on simulator you might face this issue. I guess the simulator internally may not able to connect to the internet, so that is why it was not able to connect to the server. Try restarting the simulator and check .If it still doesn't work correctly then clear all the content and data for simulator from Hardware --> Erase All Content and Settings.

If you are checking in the real device please check the internet connection of the device.

If the internet connection is working fine then there is some configuration to be done at server end with 'Keep-Alive' value in configuration. I found the same solution at multiple references as below :

https://github.com/AFNetworking/AFNetworking/issues/2801

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

Hope this helps.

Upvotes: 1

Related Questions