Reputation: 25687
I'm trying to use the following code to create a CloudKit subscription:
let container = CKContainer.defaultContainer()
let database = container.publicCloudDatabase
let recordZone = CKRecordZone.defaultRecordZone()
let subscription = CKSubscription(zoneID: recordZone.zoneID, options: .FiresOnRecordCreation | .FiresOnRecordUpdate | .FiresOnRecordDeletion)
database.saveSubscription(subscription) {(subscription: CKSubscription!, error: NSError!) in
if error
{
NSLog("Error: %@", error)
}
else if subscription
{
NSLog("Saved subscription: %@", subscription)
}
}
And it fails with this error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'CKSubscriptionTypeRecordZone subscriptions are incompatible with subscription options 7'
What does this mean, and how can I fix it? I want to be notified when a record is created, updated, or deleted.
Upvotes: 1
Views: 296