UNUserNotificationCenter.current().getPendingNotificationRequests yields empty array in Notification Service Extension

I'm sure I'm missing something obvious here, but:

  • I am scheduling local notifications in the main app when the app is backgrounded.

  • With the app backgrounded, I send a notification and the Notification Service Extension intercepts it.

  • From my NSE code, I call UNUserNotificationCenter.current().getPendingNotificationRequests but that yields an empty array, even though I have just scheduled a few notifications above.

Answered by michellepriv in 680859022

nevermind, sorry! the error was in my code, I was inadvertently unscheduling the notifications elsewhere before the NSE code ran.

Accepted Answer

nevermind, sorry! the error was in my code, I was inadvertently unscheduling the notifications elsewhere before the NSE code ran.

UNUserNotificationCenter.current().getPendingNotificationRequests yields empty array in Notification Service Extension
 
 
Q