Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Ambiguous use of 'firesOnRecordCreation'" when making a CKQuerySubscription

Tags:

ios

cloudkit

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])
like image 434
01GOD Avatar asked Jan 22 '26 20:01

01GOD


1 Answers

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.

like image 74
Clifton Labrum Avatar answered Jan 25 '26 11:01

Clifton Labrum



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!