如何测试静默通知在 iOS 中是否有效?

How to test that silent notifications are working in iOS?

我有一个使用无声通知订阅的程序:

let predicate = NSPredicate(format: "recordID == %@", CKRecordID(recordName: "ListName"))

let silentNotification = CKNotificationInfo()
silentNotification.shouldSendContentAvailable = true
silentNotification.desiredKeys = ["Update"]

let subscription = CKSubscription(recordType: "Lists", predicate: predicate, options: .FiresOnRecordUpdate)
subscription.notificationInfo = silentNotification

saveSubscription(subscription)

我现在可以在 CloudKit 仪表板中看到订阅,但是在更新所跟记录的 Update 值时,我的应用程序没有收到通知。

由于静默通知是基于尽力而为的,因此不立即收到是否正常?我正在使用 iOS 模拟器并希望能够调试我的应用程序,在使用静默通知时我该怎么做?

这是一个 CloudKit 错误。更新通知仍然无效。

参见:

请在 apple https://bugreport.apple.com/ 提交错误报告 许多人已经这样做了,但显然它还需要苹果更多的关注。