If I try subscribe to CloudKit with this code:
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];
}
}];
I sometimes get this error:
CKError 0x17558460: "Server Rejected Request" (15/2000); server message = "Internal server error"; uuid = B89DE7A4-9D22-42BC-9CD4-4330F3FE04EF; container ID = "iCloud.com.app.testApp"
or
CKError 0x14fb3510: "Service Unavailable" (6/2022); server message = "failed up to install schema, CAS failed"; uuid = F562D1AD-B40E-4842-A5EA-2A5F800C18F2; container ID = "iCloud.com.app.testApp"
Anybody know how to fix that? Can I do something with my code? Is this Apple problem and I can't do anything? Thanks.