草庐IT

getDeliveredNotifications

全部标签

swift - UNUserNotificationCenter.current().getDeliveredNotifications 只返回空数组

我正在尝试检索仍显示在通知中心的所有已发送通知,但UNUserNotificationCentergetDeliveredNotifications(completionHandler:)不起作用。我可以使用UNUserNotificationCentergetPendingNotificationRequests(completionHandler:)获取所有未决通知,但是getDeliveredNotifications将始终返回0计数,即使通知中心上有通知也是如此。 最佳答案 根据这个:NUserNotificationCen

swift - 在 getDeliveredNotifications(completionHandler :) method) 中读取推送通知负载详细信息

这是我的推送通知负载。{"userId":"QA-207-222820","title":"PushnewNotification","message":"NewNotification","deviceId":"70","deviceName":"R70","notificationType":"1"}无法读取ios10中getDeliveredNotifications方法内的通知对象中的上述有效负载键和值。这是getDeliveredNotifications方法中通知对象的详细信息。,hasDefaultAction:YES,defaultActionTitle:(null),

ios - UNUserNotificationCenter.current().getDeliveredNotifications 只返回一个空数组

基本上,我只是想打印我的应用程序已发送的通知,但会执行类似以下操作:UNUserNotificationCenter.current().getDeliveredNotifications{(notifications)inprint(notifications)}只是在Xcode控制台中显示一个空数组,即使通知中心包含多个已发送的通知也是如此。(print(notifications.count)返回0)我可以使用getPendingNotificationRequests成功获取已安排但未送达的通知,更新它们,甚至使用removePendingNotificationRequest