Instance Method

scheduleWithBlock:

Begins scheduling the background activity.

Declaration

- (void)scheduleWithBlock:(void (^)(NSBackgroundActivityCompletionHandler completionHandler))block;

Parameters

block

A block of code to execute when the scheduler runs. This block will be called on a serial background queue appropriate for the level of quality of service specified. See qualityOfService.

Discussion

When your block is called, it’s passed a completion handler as an argument. Configure the block to invoke this handler, passing it a result of type NSBackgroundActivityResult to indicate whether the activity finished (NSBackgroundActivityResultFinished) or should be deferred (NSBackgroundActivityResultDeferred) and rescheduled for a later time. Failure to invoke the completion handler results in the activity not being rescheduled. For work that will be deferred and rescheduled, the block may optionally adjust scheduler properties, such as interval or tolerance, before calling the completion handler. See Schedule Activity with scheduleWithBlock:.

See Also