I manage to save, change and delete records in Apples CloudKit. I even got notifications working with subscriptions, what I can not find out is, how do i list all subscriptions for the current user.
Here is my code so far:
let operation = CKFetchSubscriptionsOperation()
operation.fetchSubscriptionCompletionBlock = { (d, e) -> Void in
println("got subscription")
if e != nil {
println("Error")
dump(e)
}
dump(d)
}
publicDatabase.addOperation(operation)
What I got is:
got subscription
Error
- <CKError 0x14db0ed0: "Invalid Arguments" (12)> #0
- 0 key/value pairs
What are the Invalid Arguments? And how do i get a list of all saved subscriptions?
If you want to do something with your subscriptions, then you could use something like this:
var database = CKContainer.defaultContainer().publicCloudDatabase
database.fetchAllSubscriptionsWithCompletionHandler({subscriptions, error in
for subscriptionObject in subscriptions {
var subscription: CKSubscription = subscriptionObject as CKSubscription
..
}
}
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