我正在使用 CloudKit 在应用程序中工作,并且正在创建对 CloudKit 的订阅。这是我的代码:
CKSubscription *subscription = [[CKSubscription alloc]
initWithRecordType:recordType
predicate:predicate
options:CKSubscriptionOptionsFiresOnRecordCreation |
CKSubscriptionOptionsFiresOnRecordUpdate |
CKSubscriptionOptionsFiresOnRecordDeletion];
CKNotificationInfo *notificationInfo = [CKNotificationInfo new];
notificationInfo.shouldSendContentAvailable = YES;
subscription.notificationInfo = notificationInfo;
notificationInfo.shouldBadge = YES;
CKDatabase *publicDatabase = [container publicCloudDatabase];
[publicDatabase saveSubscription:subscription
completionHandler:^(CKSubscription *subscription, NSError *error) {
if (!error)
{
NSLog(@"subscription success!");
}
else
{
NSLog(@"subscription error%@", error.localizedDescription);
}
}];
我的问题给你们。如何查询或验证用户对 CloudKit 的订阅?