如果我尝试使用以下代码订阅 CloudKit:
NSPredicate *truePredicate = [NSPredicate predicateWithValue:YES];
CKSubscription *itemSubscription = [[CKSubscription alloc] initWithRecordType:RecordType
predicate:truePredicate
options:CKSubscriptionOptionsFiresOnRecordCreation | CKSubscriptionOptionsFiresOnRecordUpdate | CKSubscriptionOptionsFiresOnRecordDeletion];
CKNotificationInfo *notification = [[CKNotificationInfo alloc] init];
notification.alertBody = @"Item Added/Updated/Deleted!";
itemSubscription.notificationInfo = notification;
[self.publicDatabase saveSubscription:itemSubscription completionHandler:^(CKSubscription *subscription, NSError *error) {
if (error) {
// In your app, handle this error appropriately.
NSLog(@"An error occured in %@: %@", NSStringFromSelector(_cmd), error);
} else {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:subscription.subscriptionID forKey:kSubscriptionID];
[defaults synchronize];
}
}];
我有时会收到此错误:
CKError 0x17558460:“服务器拒绝请求”(15/2000);server message = "内部服务器错误"; uuid = B89DE7A4-9D22-42BC-9CD4-4330F3FE04EF;容器 ID = "iCloud.com.app.testApp"
或者
CKError 0x14fb3510:“服务不可用”(6/2022);server message = "安装模式失败,CAS失败"; uuid = F562D1AD-B40E-4842-A5EA-2A5F800C18F2;容器 ID = "iCloud.com.app.testApp"
有人知道如何解决吗?我可以用我的代码做点什么吗?这是Apple的问题,我无能为力吗?谢谢。