When previousServerToken is null, CKFetchRecordChangesOperation seems to take several passes to download the first set of data, retrying until the moreComing flag is clear.
It isn't because there are too many records- In my testing I only have around 40 member records, each of which belong to one of the 6 groups.
The first pass gives two badly-formed member records; the second pass sometimes sends a few member records from a group that has not yet been downloaded, or nothing. Only after the third pass does it download all the remaining groups and members as expected.
Any ideas why this might be?
This can happen if the zone has had lots of records deleted in it. The server scans through all of the changes for the zone and then drops changes for records that have been deleted. Sometimes this can result in a batch of changes with zero record changes, but moreComing
set to true.
Take a look at the new fetchAllChanges
flag on CKFetchRecordZoneChangesOperation
in iOS 10/macOS 10.12. CloudKit will pipeline fetch changes requests for you and you'll just see record changes and zone change tokens until everything in the zone has been fetched.