CloudKit fetch all subscriptions from the current user

有些话、适合烂在心里 提交于 2019-12-04 09:39:21

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
            ..
        }
    }

I haven't tried this yet but according to the docs; fetchAllSubscriptionsOperation() will get all subscriptions for the user in the current database, assigning the value of this call to fetchSubscriptionCompletionBlock should then work. Adjust the following line of code to:

let operation = CKFetchSubscriptionsOperation.fetchAllSubscriptionsOperation()

Quick Help Notes

Again, according to the docs fetchAllSubscriptionsWithCompletionHandler will fetch all subscriptions on the current database:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!