Framework

BackgroundTasks

Request the system to launch your app in the background to run tasks.

Overview

Use the BackgroundTasks framework to keep your app content up to date and run tasks requiring minutes to complete while your app is in the background. Longer tasks can optionally require a powered device and network connectivity.

Register launch handlers for tasks when the app launches and schedule them as required. The system will launch your app in the background and execute the tasks.

Topics

Essentials

BGTaskScheduler

A class for registering launch handlers that are run by submitting task requests to launch your app in the background.

Starting and Terminating Tasks During Development

Use the debugger to start tasks and terminate them before completion during development.

Refreshing and Maintaining Your App Using Background Tasks

Use scheduled background tasks for refreshing your app content and for performing maintenance.

Requests

BGProcessingTaskRequest

A request to launch your app in the background to execute a processing task that can take minutes to complete.

BGAppRefreshTaskRequest

A request to launch your app in the background to execute a short refresh task.

BGTaskRequest

An abstract class for representing task requests.

Task Management

BGProcessingTask

A time-consuming processing task that runs while the app is in the background.

BGAppRefreshTask

An object representing a short task typically used to refresh content that’s run while the app is in the background.

BGTask

An abstract class representing a task that’s run while the app is 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