Instance Method

fetchRecordWithID:completionHandler:

Fetches one record asynchronously, with a low priority, from the current database.

Declaration

- (void)fetchRecordWithID:(CKRecordID *)recordID completionHandler:(void (^)(CKRecord *record, NSError *error))completionHandler;

Parameters

recordID

The ID of the record you want to fetch. This method throws an exception if this parameter is nil.

completionHandler

The block to execute with the results. Your block must be capable of running on any thread of the app and must take the following parameters:

record

The requested record object. If no such record is found, this parameter is nil.

error

An error object, or nil if the record was fetched successfully. Use the information in the error object to determine whether a problem has a workaround.

Discussion

Use this method to fetch records that are not urgent to your app’s execution. This method fetches the record with a low priority, which may cause the fetch to execute after higher-priority tasks. To fetch records more urgently, create a CKFetchRecordsOperation object with the desired priority. You can also use that operation object to fetch multiple records simultaneously.

See Also

Accessing Records

- saveRecord:completionHandler:

Saves one record asynchronously, with a low priority, to the current database, if the record has never been saved or if it is newer than the version on the server.

- deleteRecordWithID:completionHandler:

Deletes the specified record asynchronously, with a low priority, from the current database.

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