Marks the beginning of a new long-running background task with the specified name.
- iOS 7.0+
- tvOS 9.0+
The name to display in the debugger when viewing the background task. If you specify
nilfor this parameter, this method generates a name based on the name of the calling function or method.
A handler to be called shortly before the app’s remaining background time reaches 0. You should use this handler to clean up and mark the end of the background task. Failure to end the task explicitly will result in the termination of the app. The handler is called synchronously on the main thread, blocking the app’s suspension momentarily while the app is notified.
A unique identifier for the new background task. You must pass this value to the
end method to mark the end of this task. This method returns
UIBackground if running in the background is not possible.
The behavior of this method is identical to the behavior of the
begin method except for the addition of an explicit name for the task.