Xcode is throwing a very ambiguous error:
Ambiguous use of 'firesOnRecordCreation'
when making a CKQuerySubscription. Actually it does that on every option added to that call. Is that a compiler bug? Solution?
let predicate = NSPredicate(value: true)
let subscriptionID = "notes-changed"
let noteSubscription = CKQuerySubscription(recordType: "Notes",
predicate: predicate,
subscriptionID: subscriptionID,
options: [.firesOnRecordCreation,
.firesOnRecordDeletion,
.firesOnRecordUpdate])
Which version of Xcode and Swift are you using? If you are on Swift 5, you need to use the full CKQuerySubscription.Options name like this:
let noteSubscription = CKQuerySubscription(
recordType: "Notes",
predicate: NSPredicate(value: true),
subscriptionID: "notes-changed",
options: [
CKQuerySubscription.Options.firesOnRecordCreation,
CKQuerySubscription.Options.firesOnRecordUpdate,
CKQuerySubscription.Options.firesOnRecordDeletion
]
)
I hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With