Hello. I want to use CloudKit to send notifications to users of my app. I created record type for notification and I use this code to sub
let subscription = CKQuerySubscription(recordType: "Notifications", predicate: NSPredicate(format: "TRUEPREDICATE"), options: .firesOnRecordCreation)
let info = CKSubscription.NotificationInfo()
info.titleLocalizationKey = "%1$@"
info.titleLocalizationArgs = ["title"]
info.alertLocalizationKey = "%1$@"
info.alertLocalizationArgs = ["content"]
info.shouldBadge = true
info.soundName = "default"
subscription.notificationInfo = info
CKContainer(identifier: "iCloud.****").publicCloudDatabase.save(subscription, completionHandler: { subscription, error in
if error == nil {
// Subscription saved successfully
print(subscription?.notificationInfo?.description)
} else {
// Error occurred
print(error?.localizedDescription)
}
})
The subscription is successful and when I create a record via from CloudKit, my local device received push notification normally.
My issue is that CloudKit console says "There are no subscriptions in this database!!!"
Do anyone say how I can see subscription?