Skip to end of metadata
Go to start of metadata

iOS SDK Deleting Content - CM


- (void)deleteRecordWithID:(PWCMERecordID *)recordID
         completionHandler:(void (^)(PWCMERecordID *recordID, NSError *error))completionHandler;

Deleting a record may trigger additional deletions if the record was referenced by other records. This method reports only the ID of the record you asked to delete. PWCME does not report deletions triggered by owning relationships between records.

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


recordID – The ID of the record you want to delete. 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:

  • recordID: The record ID you attempted to delete. 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] deleteRecordWithID:recordID
                                    completionHandler:^(PWCMERecordID *recordID, NSError *error) {
    if (!error) {
        // The record was successfully deleted.
    else {
        // Something went wrong. Be sure to handle the error!
        NSLog(@"Error: %@", error.debugDescription);


  • No labels