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 backgroundRefreshStatus: UIBackgroundRefreshStatus

Indicates whether the app can refresh content when running in the background.

enum UIBackgroundRefreshStatus

Constants indicating whether background execution is enabled for the app.

class let backgroundRefreshStatusDidChangeNotification: NSNotification.Name

Posted when the app’s status for downloading content in the background changes.

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

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

struct UIBackgroundTaskIdentifier

A unique token that identifies a request to run in the background.

var backgroundTimeRemaining: TimeInterval

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

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software