Add an ability for extensions to perform extended background tasks like UIApplication.beginBackgroundTask(withName:expirationHandler:)
| Originator: | akisutesama | ||
| Number: | rdar://32671165 | Date Originated: | June 9 2017 |
| Status: | Resolved: | ||
| Product: | iOS SDK | Product Version: | |
| Classification: | Reproducible: |
Area: UIKit Summary: Currently, any app extensions in iOS are not allowed to perform extended background tasks, which offers apps to perform heavy tasks like fetching, saving, or something like that when the app is about to go background. All extensions are always subjected to be terminated on behave of iOS task management to minimize resource usages, but sometimes this interruption makes some horrible failures like data lost or even deadlocking shared app container files, described in this issue: https://github.com/realm/realm-cocoa/issues/4797 We can't prevent this by ourselves, so we are in need of some APIs that provides an extend task execution for a limited time. Steps to Reproduce: N/A Expected Results: An API to request a small window to perform extended background job is officially provided, to prevent critical transactions failing, like saving some data to a shared app container. Observed Results: Sometimes, extensions are suddenly terminated by iOS task manager system and there is no way to prevent this happening for us. So when this occurs while critical transaction in extensions, we'll get screwed. Version: Verified in iOS 10.3.2, Today Extension. Notes: Perhaps providing an notification when extensions are about to be terminated by iOS will give us at least a small window to abort an ongoing task and release a lock to prevent disasters, but I still believe having a background window is much beneficial. Configuration: N/A
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!