Hello.
I am not receiving a response in the `recordWithIDWasDeletedBlock` for `CKFetchRecordZoneChangesOperation` for items that have been shared with me, but deleted by the person who shared them.
For example, say a user shared a photo album with me that contains many photos. The person who shared it with me deleted a photo from the photo album. When I as the user who the album was shared with request changes to the shared database with `CKFetchRecordZoneChangesOperation`, the `recordWithIDWasDeletedBlock` does not get called when performing the `CKFetchRecordZoneChangesOperation` operation.
I do get changes from the `recordChangedBlock` but the `recordWithIDWasDeletedBlock` is never called.
Thanks for any insight you can provide.
Here's my sample code:
func fetchChanges(in recordZoneIDs: [CKRecordZoneID]) {
let operation = CKFetchRecordZoneChangesOperation(recordZoneIDs: recordZoneIDs,
optionsByRecordZoneID: nil)
var recordsToSave = [CKRecord]()
var recordIDsToDelete = [CKRecordID]()
operation.recordZoneFetchCompletionBlock = { _, changeToken, _, _, error in
if let error = error {
// TODO:- Handle error
return
}
if let changeToken = changeToken {
// TODO:- Update change token
}
}
operation.recordZoneChangeTokensUpdatedBlock = { _, changeToken, _ in
// TODO:- Update change token
}
operation.fetchRecordZoneChangesCompletionBlock = { error in
if let error = error {
// TODO:- Handle error
return
}
// Functions that save records to local cache
self.save(recordsToSave)
self.delete(recordIDsToDelete)
}
operation.recordWithIDWasDeletedBlock = { recordID, _ in
recordIDsToDelete.append(recordID) // This never gets called even when a shared record has been deleted :(
}
operation.recordChangedBlock = { record in
recordsToSave.append(record)
}
CKContainer.default().sharedCloudDatabase.add(operation)
}