Basically, I'm simply trying to print the notifications that my app has delivered, but doing something like:
UNUserNotificationCenter.current().getDeliveredNotifications { (notifications) in
print(notifications)
}
just displays an empty array in the Xcode console, even when the notification center contains several delivered notifications. (print(notifications.count)
returns 0)
I can use getPendingNotificationRequests
to successfully grab the notifications that are scheduled yet undelivered, update them, and even remove them with removePendingNotificationRequests(withIdentifiers:)
. But any attempt to access/modify/remove anything that's been delivered does not work.
Am I missing something simple here? Did something change recently with the way iOS 10+ accesses the delivered notifications?