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.
the server change token is returned in a different block - you need to use recordZoneFetchCompletionBlock.