A background task that helps you respond to NSURLSession background transfers.


@interface WKURLSessionRefreshBackgroundTask : WKRefreshBackgroundTask


Always upload and download data using an NSURLSession background transfer. Background transfers occur in a separate process. They continue to transfer the data even after your app has terminated. Asynchronous uploads and downloads, on the other hand, are suspended with your app. Given the short run time of watchOS apps, you cannot guarantee that an asynchronous transfer will finish before the app is suspended. For more information on background transfers, see Background Transfer Considerations.

Do not subclass or create instances of this class. Instead, the system instantiates a WKURLSessionRefreshBackgroundTask object, and passes the task object to your extension delegate’s handleBackgroundTasks: method in response to NSURLSession events. The system creates a background NSURLSession task when any of the following events occur:

  • Authentication is required to complete a background transfer.

  • All background transfers associated with a session identifier have completed (either successfully or unsuccessfully).

To get more information about the transfer, create a background configuration object with the same session identifier. Next, create a session object using the configuration object and a session delegate. The new session is automatically reassociated with the transfer, and the appropriate delegate methods are called.

You will need to defer calling the background NSURLSession task’s setTaskCompleted method until after you are done processing these delegate method calls.


Accessing Background Task Data


The identifier for the triggering background transfer.


See Also

Background Tasks

Running watchOS Apps in the Background

Schedule and perform background tasks from within your app.

Playing Background Audio

Enable background audio in your app to provide a seamless playback experience.

Preparing to Take Your watchOS App’s Snapshot

Use snapshot background tasks to provide a timely, accurate snapshot of your app.


The abstract superclass for WatchKit's other background task classes.


A background task used to update your app’s state in the background.


A background task used to receive background updates from the Watch Connectivity framework.


A background task used to update your app’s user interface in preparation for a snapshot.


A background task used to update your app after a SiriKit intent runs.


A background task used to periodically donate relevant Siri shortcuts.

Background Session Keys

Enable background sessions.