0

I am using silent notifications for the purpose of notifying my app when new content is available. With iOS 11.0 to iOS 11.1, the silent notifications rarely get delivered to the app on background. However, I would want to at least process the silent notifications when the app becomes active again.

I did not find a way to get a list of the silent notifications. I have tried:

let center = UNUserNotificationCenter.current()
center.getPendingNotificationRequests(completionHandler: { (notifications) in
    notifications.forEach({ (notification) in
        print(notification)
    })
})
center.getDeliveredNotifications { (notifications) in
    notifications.forEach({ (notification) in
        print(notification)
    })
}

I know that the notifications are received by the phone because I have checked the device logs. However, they do not seem to be forwarded to the app even when it becomes active. Is there a way to access them?

TudorZg
  • 11
  • 2
  • Is there a reason you can't use the `UIApplicationDelegate` protocol methods? – Alex Nov 21 '17 at 17:33
  • I am using the UIApplicationDelegate methods, I always receive remote push notifications and I receive the silent ones on foreground. When the OS allows it, I will receive them in background as well, but that is unpredictable and not reliable. My problem is that I do not know how to at least access them when I open the app. I also have "Background Modes" capabilities enabled. – TudorZg Nov 21 '17 at 18:55
  • Silent notifications **do not** come through the notification center. They only come through the app delegate. – jscs Nov 21 '17 at 19:59
  • @JoshCaswell, that's good to know, thank you. But still, is there a way to access them as soon as the app becomes active? – TudorZg Nov 22 '17 at 09:57

0 Answers0