篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了swift Swift - CloudKit - 删除订阅相关的知识,希望对你有一定的参考价值。
See:https://www.hackingwithswift.com/read/33/8/delivering-notifications-with-cloudkit-push-messages-ckquerysubscription
let database = CKContainer.default().publicCloudDatabase
database.fetchAllSubscriptions { [unowned self] subscriptions, error in
if error == nil {
if let subscriptions = subscriptions {
for subscription in subscriptions {
database.delete(withSubscriptionID: subscription.subscriptionID) { str, error in
if error != nil {
// do your error handling here!
print(error!.localizedDescription)
}
}
}
// more code to come!
}
} else {
// do your error handling here!
print(error!.localizedDescription)
}
}
以上是关于swift Swift - CloudKit - 删除订阅的主要内容,如果未能解决你的问题,请参考以下文章