Instance Method

initWithPreviousServerChangeToken:

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

Declaration

- (instancetype)initWithPreviousServerChangeToken:(CKServerChangeToken *)previousServerChangeToken;

Parameters

previousServerChangeToken

The change token from a previous fetch operation, or nil to fetch all changes. When you specify a change token, the operation object fetches only the changes that occurred since the change token was generated.

Return Value

An initialized operation object.

Discussion

The first time you fetch notifications, specify nil for the previousServerChangeToken to get information about all push notifications that have been sent. When that operation finishes executing, it passes a change token to your completion block. Save that change token and use it to initialize new operation objects that fetch only the newly generated notification objects.

If you mark one or more notifications as read using a CKMarkNotificationsReadOperation object, those notifications are not returned, even if you specify nil for previousServerChangeToken.

See Also

Initializing the Operation Object

- initDeprecated