Instance Property

backgroundTimeRemaining

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

Declaration

var backgroundTimeRemaining: TimeInterval { get }

Discussion

This property contains the amount of time the app has to run in the background before it may be forcibly killed by the system. While the app is running in the foreground, the value in this property remains suitably large. If the app starts one or more long-running tasks using the beginBackgroundTask(expirationHandler:) method and then transitions to the background, the value of this property is adjusted to reflect the amount of time the app has left to run.

See Also

Managing Background Execution

var applicationState: UIApplicationState

The runtime state of the app.

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.

func endBackgroundTask(UIBackgroundTaskIdentifier)

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