ios – How do I fetch the latest previousServerChangeToken: CKServerChangeToken? to not to fetch all changes, but the latest from now?

0
168


This is how I simply define my operation to fetch all changes from cloudkit.

    let options = CKFetchRecordZoneChangesOperation.ZoneConfiguration()
    options.previousServerChangeToken = Token.privateZoneServerChangeToken

This way I receive all records from CloudKit database (in my case it is ~2.1k). But the same code is also used for Apple Watch. I do not want to fetch all the changes. But I need to fetch all the changes since now. How can I get previousServerChangeToken for it?

Maybe you will have better solution than me. In my cloudkit model I have 11 different entities. But I only need 2 of them on my Apple Watch. Is there a way to fetch only selected changes? Not all of them?