CloudKit. Token change block of CKFetchRecordZoneChangesOperation not called

I am trying to implement syncing with CloudKit.

To fetch changes from the server i am using CKFetchRecordZoneChangesOperation.

However recordZoneChangeTokensUpdatedBlock not called at all.

Here is the code:



    let options = CKFetchRecordZoneChangesOptions()
    options.previousServerChangeToken = changesToken


    let operation = CKFetchRecordZoneChangesOperation(recordZoneIDs: [paletteZoneId], optionsByRecordZoneID: [paletteZoneId:options])
    operation.fetchAllChanges = true
   
    operation.recordChangedBlock = {(record) in
       ...
    }
   
    operation.recordWithIDWasDeletedBlock = { (recordId,str) in
        ...
    }
   
    operation.recordZoneChangeTokensUpdatedBlock = { recordZoneId, token, data in
        print("new token")
        self.changesToken = token
    }
       
   
    operation.fetchRecordZoneChangesCompletionBlock = { error in
        ...
    }
   
    privateDB.add(operation)




So as the result operation is not working properly. Other blocks are called as expected.



Documentation says that token block should be called per zone, but it is not called at all.



I would really appreciate any help.



Many thanks.

Replies

Hello,


I am also facing same issue in Myapp but its in Objective C .Please let me know if already found some solution.


Thanks,

Moumita

See this thread: https://forums.developer.apple.com/thread/63314