Instance Property

fetchRecordsCompletionBlock

The block to execute after all records are fetched or have received appropriate errors.

Declaration

var fetchRecordsCompletionBlock: (([CKRecord.ID : CKRecord]?, Error?) -> Void)? { get set }

Discussion

The block returns no value and takes the following parameters:

recordsByRecordID

A dictionary containing the records that are retrieved successfully. Each key in the dictionary is a CKRecord.ID object corresponding to a record you requested. The value of each key is the corresponding CKRecord object that was retrieved from the database.

operationError

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

The operation object executes this block only once and is your last chance to process the operation results. The block is executed after all of the individual progress blocks but before the operation’s completion block. The block is executed serially with respect to the other progress blocks of the operation.

This block reports an error of type CKError.Code.partialFailure when it retrieves 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 retrieved, and the corresponding values are error objects containing information about what happened.

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

See Also

Processing the Operation Results

var perRecordProgressBlock: ((CKRecord.ID, Double) -> Void)?

The block to execute with progress information for individual records.

var perRecordCompletionBlock: ((CKRecord?, CKRecord.ID?, Error?) -> Void)?

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