Instance Property

modifyRecordsCompletionBlock

The block to execute after the status of all changes is known.

Declaration

@property(nonatomic, copy, nullable) void (^modifyRecordsCompletionBlock)(NSArray<CKRecord *> *savedRecords, NSArray<CKRecordID *> *deletedRecordIDs, NSError *operationError);

Discussion

The block returns no value and takes the following parameters:

savedRecords

The array of CKRecord objects you tried to save.

deletedRecordIDs

The array of CKRecordID objects corresponding to the records you tried to delete.

operationError

An error object containing information about a problem, or nil if the results are saved successfully.

This block is executed only once and represents your last chance to process the operation results. It is executed after all individual progress blocks have completed but before the operation’s completion block. The block is executed serially with respect to the other progress blocks of the operation.

If you intend to use this block to process results, set it before executing the operation or submitting the operation object to a queue.

This block reports an error of type CKErrorPartialFailure when it saves or deletes only some of the records successfully. The userInfo dictionary of the error contains a CKPartialErrorsByItemIDKey key whose value is an NSDictionary object. The keys of that dictionary are the IDs of the records that were not saved or deleted, and the corresponding values are error objects containing information about what happened.

While this block is executed after the completion of the modification of records, it is executed prior to the indexing of queries against those modified records. Therefore, if a query is executed in this completion block the results of that query may not include the changes made by this operation. Conversely, records that are fetched in this completion block will be up to date with the changes made in the associated operation.

See Also

Processing the Operation Results

perRecordProgressBlock

The block to execute with progress information for an individual record.

perRecordCompletionBlock

The block to execute when the save results of a single record are known.