不要使用 CkFetchRecordZoneChangesOperation 获取删除更改

Do not fetch deletion changes using CkFetchRecordZoneChangesOperation

我用它从 cloudkit 数据库中获取所有记录。我传递 nil 令牌以指示我需要所有更改。后来我用适当的令牌获取最新的变化。

但我第一次得到与删除相关的数千个更改。这需要一些时间......有没有办法表明我是否需要删除更改?或者我是否可以以某种方式将那种类型的更改标记为已收到或已阅读并且不再收到它?

first time I get thousends of changes related to deletion.

我了解到您提到了将 nil 值传递给 CKFetchRecordZoneChangesOptions 中的服务器更改令牌的场景。

Is there a way to indicate whether I need deletion changes or not? Or can I somehow that type of change mark as received or read and to not get it anymore?

你得到块中已删除记录的ID:"setRecordWithIDWasDeletedBlock"

@property (nonatomic, copy, nullable) void (^recordWithIDWasDeletedBlock)(CKRecordID *recordID, NSString *recordType);

请尝试不在您的操作实例中设置该块 属性。如果未设置块,您将不会收到已删除记录的信息。所以,不要在第一次设置区块属性(即change token为nil时)

Later I fetch latest changes with apropriate token.

只有当change token不为nil时才可以设置上面提到的block!