Class

CKFetchNotificationChangesOperation

An operation that is used to retrieve unread notifications from a CloudKit container.

Declaration

@interface CKFetchNotificationChangesOperation : CKOperation

Overview

Notification objects contain the data associated with push notifications that have already been sent to an app. Fetch notification objects to identify changes that your app might have missed or to retrieve the complete push notification payload, which might have been truncated when it was delivered to the device.

A CKFetchNotificationChangesOperation object retrieves unread CKNotification objects from a container. Notification objects contain the data associated with push notifications that have already been sent to an app. Fetch notification objects to identify changes that your app might have missed or to retrieve the complete push notification payload, which might have been truncated when it was delivered to the device.

After fetching the current notifications, you can mark some or all of them as read using a CKMarkNotificationsReadOperation object. Marking a notification as read prevents it from being returned by subsequent fetch operations.

The blocks you assign to process the fetched notifications are executed serially on an internal queue that is managed by the operation object. Your blocks must be capable of executing on a background thread, so any tasks that require access to the main thread must be redirected accordingly.

If you assign a completion block to the completionBlock property of the operation object, the completion block is called after the operation executes and returns its results to you. You can use a completion block to perform housekeeping chores related to the operation, but do not use it to process the results of the operation itself. Any completion block you specify should be prepared to handle the failure of the operation to complete its task, whether due to an error or an explicit cancellation.

Topics

Initializing the Operation Object

- initWithPreviousServerChangeToken:

Initializes and returns an operation object set to fetch notification changes.

Configuring the Operation Object

previousServerChangeToken

The change token from a previous fetch operation.

resultsLimit

The maximum number of results to fetch with this operation.

Processing the Operation Results

moreComing

A Boolean value indicating that more notifications are waiting to be delivered.

notificationChangedBlock

The block that processes a single push notification.

fetchNotificationChangesCompletionBlock

The block that is executed after all requested notifications are fetched.

Relationships

Inherits From

See Also

Notification Operations

CKMarkNotificationsReadOperation

An operation that marks push notifications as read by your app.

Deprecated

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