CKFetchRecordZoneChangesOperation errors

Hello,

I'm using CKFetchRecordZoneChangesOperation to sync changes in my custom zone. Seemed to be working fine in my development environment but I'm gettign some errors when testing in the Production environment. The localized description of the two errors are shown below:


client knowledge differs from server knowledge

Couldn't fetch some items when fetching changes


Any suggestions on what can cause these errors would be appreciated.


Thanks.

Replies

OK. I did some further digging and found the root cause of the error messages. I was printing the error's localizedDescription for debugging purposes; however, upon furher inspection of the error object the ckErrorCode == .changeTokenExpired which obviously I was not handling properly!


Resetting the change token and retrying CKFetchRecordZoneChangesOperation() then yielded the correct results.


Hope this helps somebody!