Fetch after create

Hi


I have an app designed like fetch changes (from a custom zone based on tokens, CKFetchRecordZoneChangesOperation) , save locally to core data, then upload unsynced local changes. It works fine now, but I realised the next fetch is downloading the uploaded items, which completly makes sense, since the change token is not updated after the upload. My question is how to solve this situation? I did not find a way to get a new zone change token from the CKModifyRecordsOperation. Obviously I can't discard the next update completly becuase there might be other items from other device.


Thanks

Replies

Cache as you go and associate the data with the recordID, and, having received a notification that something's changed, check your cache first to determine whether you already have that data, and post a request only if you do not.

You can immediately do another CKFetch RecordZoneChangesOperation, ignore (your recent) changes, and retrieve the new change token /para/ or you can store the last change token (the one just before the current change token) in the data itself and use that as the ‘real’ change token.