Instance Method


Marks the end of a specific long-running background task.


func endBackgroundTask(_ identifier: UIBackgroundTaskIdentifier)



An identifier returned by the beginBackgroundTask(expirationHandler:) method.


You must call this method to end a task that was started using the beginBackgroundTask(expirationHandler:) method. If you do not, the system may kill your app.

This method can be safely called on a non-main thread.

See Also

Managing Background Execution

var applicationState: UIApplicationState

The runtime state of the app.

var backgroundTimeRemaining: TimeInterval

The amount of time the app has to run in the background.

var backgroundRefreshStatus: UIBackgroundRefreshStatus

The ability of the app to be launched into the background so that it can perform background behaviors.

func setMinimumBackgroundFetchInterval(TimeInterval)

Specifies the minimum amount of time that must elapse between background fetch operations.

func beginBackgroundTask(withName: String?, expirationHandler: (() -> Void)? = nil)

Marks the beginning of a new long-running background task with the specified name.

func beginBackgroundTask(expirationHandler: (() -> Void)? = nil)

Marks the beginning of a new long-running background task.