Request Timed out with Code=-1001_kCFStreamErrorCodeKey=-2102
10:30 08 Oct 2015

Sometimes network request from my app gets stuck, And I get the following error after a while,

failed with error: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out."UserInfo={NSUnderlyingError=0x1390937f0 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, NSErrorFailingURLStringKey=https://apis.xyz.xyz.com, NSErrorFailingURLKey=https://apis.xyz.xyz.com, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102, NSLocalizedDescription=The request timed out.}

Any request I make after this, The same sent request is sent out and it fails with same error. So, no new request goes out. This happens very rarely, but it does happen.

I am using NSURLSessionDataTask:dataTaskWithRequest:completionHandler to make a network calls.

ios network-programming timeout nsurlsession