I am developing my first App to use CloudKit.
I am getting "Partial Failure", "Server Record Changed", "Protection data didn't match" error on only one of a pair of CKRecords after attempting to save local changes to a custom zone.
In this case, the change is modifying a CKReference type property on both CKRecords, referencing records in the same zone, using CKModifyRecordsOperation.
The CKRecords that were modified, had only just been read from the server and in this case, no other App had attemtped to modify them after that load.
The correct data appears to be in the sent records, including same recordChangeTag.
My save method, is a series of nested blocks (maybe change to NSOperations after seeing the excelent talk at WWDC'15).
The method first attempts to save, then if there are errors, update, then save again.
The first save produces the protection error above, on one record, the second save produces Domain=NSCocoaErrorDomain Code=4097, NSDebugDescription=connection to service named com.apple.cloudd, if I send the token from the update stage or the same error as the first save if I do not send the token.
Examining the record I am sending in LLDB, there are private properties with names like : _serializeProtectionData: false, _protectionData:nil
So I checked if that data existed when I download the initial CKRecords for the freshly installed App, using CKQueryOperation.
The data is the same, I was never sent any protection data as far as I can see.
I am stuck, any suggestion to a solution would be very welcome.