UNNotificationContentExtension does not handle action from lock screen

I am having issues with the UNNotificationContentExtension and actions on the lock screen.


If the action requires authentication UIMutableUserNotificationAction.authenticationRequired and the notification is displayed on the lock screen using a UNNotificationContentExtension, the selected action is not sent to my UIApplicationDelegate to be handled.


It only occurs in the specific case above.


  • If the action does not require authentication, it works fine.
  • If the notification is displayed on an unlocked phone, it works fine.
  • If the notification is displayed on the lock screen without using the UNNotificationContentExtension, it works fine.


It seems like the phone is treating the authentication for the action like a normal unlock, instead of an authentication for an action.


For notifications that don't use UNNotificationContentExtension -- if I enter my passcode or fingerprint to authenticate an action the phone remains on the lock screen. But, if I use the UNNotificationContentExtension, the phone goes to the home screen when I enter my passcode or fingerprint to authenticate an action.


Is anyone experiencing similar behavior? And/or anything I can do to possibly fix this?

Answered by ShawnK in 179829022

Figured it out.


It seems that you have to implement the "optional" UNNotificationContentExtension protocol method didReceive(_:completionHandler:), and call the completion handler with .dismissAndForwardAction.

Accepted Answer

Figured it out.


It seems that you have to implement the "optional" UNNotificationContentExtension protocol method didReceive(_:completionHandler:), and call the completion handler with .dismissAndForwardAction.

UNNotificationContentExtension does not handle action from lock screen
 
 
Q