Coder1224
Coder1224

Reputation: 1835

CloudKit handling of ChangeTokenExpired error

From the Apple CKErrorCode documentation, it says "The previousServerChangeToken value is too old and the client must re-sync from scratch." Does anyone know exactly what they mean by "re-sync from scratch?" I interpret it as send everything locally up to iCloud, then fetch everything from the server back down. Is that correct?

Upvotes: 1

Views: 213

Answers (1)

rmaddy
rmaddy

Reputation: 318774

This is when using CKFetchDatabaseChangesOperation. If you use this operation and it is created with a specific change token, then you might get that error. If you do get the error, simply create and run another CKFetchDatabaseChangesOperation but pass nil to the init(previousServerChangeToken:) initializer.

It's possible you will get some results you've already processed in the past. Your code needs to deal with that possibility.

Upvotes: 1

Related Questions