In the WWDC 2020 session "Background execution demystified", it was mentioned that the runtime of non-discretionary Background URL Sessions (using URLSession background transfer) is influenced mainly by factors such as the App Switcher and rate limits. Based on this information, I'm curious to know if there are specific factors that similarly affect the runtime of UIApplication.shared.beginBackgroundTask(). Are there any documented constraints or system behaviors that impact how long a background task initiated by this method can run? I would appreciate any documentation or insights that could help clarify this aspect of background task management in iOS.
What factors influence the runtime of UIApplication.shared.beginBackgroundTask()?
App Switcher and rate limits → App Switcher and system budgets
Are there any documented constraints or system behaviors that impact how long a background task initiated by this method can run?
AFAIK there’s nothing officially documented here.
I talk about this unofficially in UIApplication Background Task Notes. My experience is that:
-
You usually get execution time up to some fixed limit.
-
The system can ‘call in’ your background tasks at any time, by calling the expiry handler, and you have to write your code accordingly.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"