我使用以下代码设置CKSubscription
:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"TRUEPREDICATE"];
CKSubscription *subscription = [[CKSubscription alloc] initWithRecordType:@"RecordTypeName"
predicate:predicate
subscriptionID:@"Subscription1"
options:CKSubscriptionOptionsFiresOnRecordCreation | CKSubscriptionOptionsFiresOnRecordUpdate];
CKDatabase *privateDatabase = [[CKContainer defaultContainer] privateCloudDatabase];
[privateDatabase saveSubscription:subscription completionHandler:^(CKSubscription * _Nullable subscription, NSError * _Nullable error) {
if (error) {
NSLog(@"Failed to subscribe.");
}
}];
在application:didReceiveRemoteNotification:
中,我会在添加新记录时收到通知,但在更新现有记录时我从未收到通知。
我已尝试更新CloudKit信息中心和登录同一帐户的其他设备的记录。
我正在测试iOS 9 beta 5。