Instance Method

initWithRecordZoneID:previousServerChangeToken:

Initializes and returns an operation object configured to fetch changes in the specified record zone.

Declaration

- (instancetype)initWithRecordZoneID:(CKRecordZoneID *)recordZoneID previousServerChangeToken:(CKServerChangeToken *)previousServerChangeToken;

Parameters

recordZoneID

The zone containing the records you want to fetch. The zone can be a custom zone. Syncing the default zone is not supported.

previousServerChangeToken

The change token from a previous fetch operation. This is the token passed to your fetchRecordChangesCompletionBlock handler during a previous fetch operation. Use this token to limit the returned data to only those changes that have occurred since you last made the same fetch request. If you specify nil for this parameter, the operation object fetches all records and their contents.

Return Value

An initialized operation object.

Discussion

When initializing the operation object, use the token from a previous fetch request if you have one. You can archive tokens and write them to disk for later use if needed.

The returned operation object is configured to retrieve all changed fields of the record, including any assets stored in those fields. If you want to minimize the amount of data returned even further, configure the desiredKeys property with the subset of keys whose values you want to fetch.

After initializing the operation, associate at least one progress block with the operation object (excluding the completion block) to process the results.

See Also

Initializing the Operation Object

- initDeprecated