how to tell CKModifyRecordsOperation to issue a insert or update?

how to tell CKModifyRecordsOperation to issue a insert or update?

my app called CKModifyRecordsOperation three times, iCloud created three records for it.

but actually it was the same record, how can I make it to the same record? to make recordID same?

Accepted Reply

Yes, the CKRecordID (is unique and) remains the same for the life of the record.

Replies

If you're using the same recordID with the record each time, it should update the existing record. Are you sure the recordID is exactly the same?

One typical way of modifying a record is to first get the record through a CKFetchRecordsOperation, modify the record and then save it through a CKModifyRecordsOperation. In this case the record will have the same CKRecordID as the original and it will overwrite the old record.


Alternatively, you need to get the CKRecordID from the original record and use that to cerate the 'new' record.

does the CKRecordID remain the same in the lifetime of that record?

My app has a local cache for each record, that's why I want to skip the fetch part.

Yes, the CKRecordID (is unique and) remains the same for the life of the record.