Skip to content

Instantly share code, notes, and snippets.

@jazzedge
Last active November 30, 2017 16:38
Show Gist options
  • Select an option

  • Save jazzedge/1a276e58aeebfe0677bbb36ba62d3eb6 to your computer and use it in GitHub Desktop.

Select an option

Save jazzedge/1a276e58aeebfe0677bbb36ba62d3eb6 to your computer and use it in GitHub Desktop.
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)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment