Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSUnderlyingError=0x608000244a70 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, NSErrorFailingURLStringKey=http://www.dfdd, NSErrorFailingURLKey=http://www.dfdd.com, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102, NSLocalizedDescription=The request timed out.}
Am getting this response calling MY API.. am using alamofire to call the api.. Is any problem in alamofire or local API
答案 0 :(得分:2)
You have to following solution.
Set request timeout to session manager
manager.session.configuration.timeoutIntervalForRequest = 120
答案 1 :(得分:1)
The main causes of this issue are either:
You should check your API & Server logs to look for any potential issues there, ensure there are no errors and that the API is capable of handling your requests as the app scales.
Also, you should add some additional error handling in your application so that if this issue does occur, not only do you handle the case properly and show the user that an error occured (or retry) and also log/report the error so that you can respond to it and investigate.
Sometimes users connections will drop due to loss of mobile signal or other reasons so you need to handle this gracefully.