Why doesn't my app suspend immediately after my long-running background task completes?
An app running on iOS 8 uses a long-running background task to avoid being suspended when it enters the background. All is well. When the task is complete, the app invokes the background task completion handler:
[[UIApplication sharedApplication] endBackgroundTask:backgroundTask];
backgroundTask = UIBackgroundTaskInvalid;
However, a call to backgroundTimeRemaining
returns a 40 second time interval.
[[UIApplication sharedApplication] backgroundTimeRemaining]
Indeed, the app doesn't suspend for at least another 20 seconds after ending the task.
- Why is this happening?
- Will the app always receive the full execution time?
- Can I hasten app suspension?