Skip to end of metadata
Go to start of metadata

iOS SDK Fetching Content - CM


- (void)fetchRecordWithID:(PWCMERecordID *)recordID
        completionHandler:(void (^)(PWCMERecord *record, NSError *error))completionHandler 

This method fetches the record with a default priority, which may cause the task to execute after higher-priority tasks. If you want to fetch records more urgently, create a PWCMEFetchRecordsOperation object with the desired priority. You can also use that operation object to fetch multiple records simultaneously.


recordID – The ID of the record you want to fetch. An exception is thrown 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.

Sample Code

PWCMERecordID *recordID = ...;
[[PWCMEContainer defaultContainer] fetchRecordWithID:recordID
                                   completionHandler:^(PWCMERecord *record, NSError *error) {
    if (!error) {
        // Use the record.
    else {
        // Something went wrong. Be sure to handle the error!
        NSLog(@"Error: %@", error.debugDescription);


  • No labels