I use:

CKModifyRecordsOperation *cKModifyRecordsOperation = [[CKModifyRecordsOperation alloc] initWithRecordsToSave:recordsToAddOrSave recordIDsToDelete:recordsIDsToDelete];
cKModifyRecordsOperation.savePolicy = CKRecordSaveChangedKeys;
cKModifyRecordsOperation.modifyRecordsCompletionBlock = ^( NSArray *savedRecords, NSArray *deletedRecordIDs, NSError *error ) {
  if ( error )
  {
      NSLog(error.description);
  }

While this works for some record types, for a specific record type I now get the following error message:

CKError 0x170844bc0: "Invalid Arguments" (12)

This is strange because it worked before, even for this record type.

I've checked the forums and did Google searches but could not find any useful information about this error in the context of CKModifyRecordsOperation.

2

There are 2 answers

1
Simon On

I'm not 100% sure of this, but this is what I found in the documentation for ChangedKeys:

A policy that saves only those fields of the record that actually changed, overwriting any values currently on the server. Unmodified fields are left untouched.

To me that sounds like that key only is for modifying the records, not deleting them.

0
shadowcharly On

In case anyone finds himself in the same spot as me, when i used some code like that, i received the same error code when passing CKRecordID instead of CKRecord in the array of records to modify.

Maybe that's your problem too?