I have a working background URLSession. I know that upon creating an URLSession with the same session identifier I get a "background URLSession with identifier x already exists"
message.
I know that I can store the session and call .finishTasksAndInvalidate()
on it if needed.
My use case is that if the application terminates, and the user relaunches the application before the background task completes, I need to be able to check if a background URLSession with the same identifier exists, and if it does, restitute the application state with the same handlers (so that I can update a UIProgressView for example).
I have two questions:
- How do I check that a background URLSession with a given identifier already exists?
- Does the AppDelegate completion handler still get called if the application was terminated and relaunched?