A handler called shortly before the task’s background time expires.
- iOS 13.0+
- Mac Catalyst 13.0+
- tvOS 13.0+
The expiration handler takes no arguments and has no return value. Use the handler to cancel any ongoing work and to do any required cleanup in as short a time as possible.
The handler may be called before the background process uses the full amount of its allocated time.
The time allocated by the system for expiration handlers doesn’t vary with the number of background tasks. All expiration handlers must complete before the allocated time.
Not setting an expiration handler results in the system marking your task as complete and unsuccessful instead of sending a warning.
The manager sets the value
nil after the handler completes.