Attempting to save CKQuerySubscription yields 503 error

I'm building a CloudKit app, and I'm trying to get a subscription working for the iOS app. Subscriptions work in the web app. This code gives me a "Request failed with http status code 503".

myContainerId is the container ID in CloudKit Dashboard.

Code Block
let predicate = NSPredicate(value: true)
let subscription = CKQuerySubscription(recordType: "Task", predicate: predicate, subscriptionID: "ios-tasks", options: [ CKQuerySubscription.Options.firesOnRecordCreation, CKQuerySubscription.Options.firesOnRecordUpdate, CKQuerySubscription.Options.firesOnRecordDeletion])
subscription.zoneID = CKRecordZone.ID(zoneName: "com.apple.coredata.cloudkit.zone", ownerName: CKCurrentUserDefaultName)
let info = CKSubscription.NotificationInfo()
info.shouldSendContentAvailable = true
subscription.notificationInfo = info
let aContainer = CKContainer(identifier: myContainerId)
let operation = CKModifySubscriptionsOperation(subscriptionsToSave: [subscription], subscriptionIDsToDelete: [])
operation.modifySubscriptionsCompletionBlock = { (sub, subIds, error) in
guard error == nil else {
if let error = error {
print("error while saving subscription: \(error.localizedDescription)")
}
return
}
print("Saved subscription!")
}
operation.qualityOfService = .utility
aContainer.privateCloudDatabase.add(operation)

I'm primarily using an NSFetchedResultsController, and that's working great. When I go to CloudKit Dashboard, I see entities stored in my private database under the com.apple.coredata.cloudkit.zone zone.

I'm guessing this is a configuration issue or something?


Replies

Please file a report using Feedback Assistant with more details (including your actual container name and logs showing this error) so we can take a closer look. Feel free to post the ID for the Feedback report to this thread.
Thanks. Feedback id is 8016440