I'm working on Xcode 8.3 with iOS 10 and I followed Apple's Cloud Kit Quick Start document for maintaining a local cache of cloud data, and my device was able to receive push notification when the data in a private database zone was changed, but when trying to fetch the zone changes I always get the following errors:
2017-06-17 11:58:11.376807-0400 MyApp[10694:5029263] received remote notification
2017-06-17 11:58:11.897402-0400 MyApp[10694:5031532] fetch database change completed
2017-06-17 11:58:11.897606-0400 MyApp[10694:5031532] zone deletions
2017-06-17 11:58:12.320908-0400 MyApp[10694:5031561] record zone fetch completed
Error fetching zone changes for private database: <CKError 0x170256620: "Invalid Arguments" (12/2006); server message = "Bad sync continuation data"; uuid = xxxxxxxx-EFD7-459D-xxxx-xxxxxxxxxxx; container ID = "iCloud.com.mycompany.MyApp">
2017-06-17 11:58:12.332247-0400 MyApp[10694:5031561] fetch record zone changes completed
Error fetching zone changes for private database: <CKError 0x174640150: "Partial Failure" (2/1011); "Couldn't fetch some items when fetching changes"; uuid = xxxxxxxx-EFD7-459D-xxxx-xxxxxxxxxxx; container ID = "iCloud.com.mycompany.MyApp"; partial errors: {
PrivateZone:__defaultOwner__ = <CKError 0x170254670: "Invalid Arguments" (12/2006); server message = "Bad sync continuation data">
}>
The "Bad sync continuation data" is quite confusing as I cannot find an explanation of this error in Apple's document or find any reference in google search. Does anyone encounter this before?
After pondering more about the meaning of "continuation" in this context, and digging deeper into the Apple example, I realized the problem was that I just kept one variable for server change tokens returned at different fetch change stages, as represented by the fetchDatabaseChanges
and fetchZoneChanges
methods. After adding variables to track the database change tokens and zone change tokens (each zone has its own), the "Bad sync continuation data" error disappeared and I can see changed records returned from server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With