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.
How to make my webApi call to get success even when app goes to background state?
Please read this post and then write back if you have further questions.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"