Instance Method


Schedules a background task to refresh your app’s data.


- (void)scheduleBackgroundRefreshWithPreferredDate:(NSDate *)preferredFireDate userInfo:(id<NSSecureCoding, NSObject>)userInfo scheduledCompletion:(void (^)(NSError *error))scheduledCompletion;



The time of the next background app refresh task. The system makes every effort to wake your app in the background at some point after the scheduled time, but the precise time is not guaranteed.


A dictionary of custom information associated with the background app refresh task. Pass nil if you do not need to associate any custom data with the task.


A block that is called by the system after the background app refresh task has completed. This block takes the following parameter:


If an error occurs, this parameter contains an object describing the error; otherwise, it is nil.


Call this method to update the contents of your app in the background. Background refresh tasks only trigger when the app is in the background. If the app is still running in the foreground at the scheduled time, the system ignores the task.

When the task is triggered, the system wakes your app in the background and calls your extension delegate’s handleBackgroundTasks: method. The system also calls your active interface controller’s willActivate and didActivate methods. You can check your extension’s applicationState during these methods to determine whether your app is running in the foreground or in the background.

Use this task to update your application’s state. Often you use background app refresh tasks to schedule other background tasks (for example, NSURLSession background transfers or snapshot updates). You can only schedule one background app refresh task at a time. If a background app refresh task has already been scheduled, scheduling a second task cancels the first. Background app refresh tasks are also budgeted. For more information, see WKApplicationRefreshBackgroundTask.

See Also

Managing the Execution State


The runtime state of the Watch app.


The running states of your Watch app.


A Boolean value that indicates whether the app is running in the dock.


A Boolean value that determines whether the app extends its time as the frontmost app.