We have an application which relies on network calls from the server.
There is a case (I cannot replicate it) where when the app comes to foreground from the background the network call which was in process before the app went to background times-out. It is the only time which a network call will fail.
Does anyone has an idea why this is happening?
Alamofire Configuration + Request:
let configuration = URLSessionConfiguration.default
configuration.timeoutIntervalForRequest = 7 // seconds
AFManager = Alamofire.SessionManager(configuration: configuration)
AFManager.request(url, method: .post, parameters: parameters, encoding: JSONEncoding.default).validate().responseString { response in
if response.result.isSuccess {
print(response)
completion()
} else {
print(response.error!)
completion()
}
}