Hi,
I used URLSession to call Api.
Code sample :
let defaultSessionConfiguration = URLSessionConfiguration.default
defaultSessionConfiguration.timeoutIntervalForRequest = 600
defaultSessionConfiguration.timeoutIntervalForResource = 600
defaultSessionConfiguration.urlCache = URLCache(memoryCapacity: 0, diskCapacity: 0, diskPath: nil)
defaultSessionConfiguration.requestCachePolicy = .reloadIgnoringLocalAndRemoteCacheData
let defaultSession = URLSession(configuration: defaultSessionConfiguration)
let task = defaultSession.dataTask(with: urlRequest) { data, response, error in
...
}
task.resume()
}
When service was called and it was not completed,I pressed home button.
So app went to background state.
And Api call was failed....
How to make Api call to get success in this scenerio and what is reason for api call failure?
Thanks in advance for the supporter.