pcg26 pcg26 - 8 months ago 29
Swift Question

Action button show app on foreground

If I tap the notification, it will open the app, but when I add button to the notification, and the user press a button the app stay on background, I want the same operation as tap on the notification (open the app on frontend)

Its possible?

Solved! Thanks for the answer:

let actionButton = UIMutableUserNotificationAction()
actionButton.identifier = identifier
actionButton.title = title
actionButton.activationMode = UIUserNotificationActivationMode.Foreground
actionButton.authenticationRequired = true
actionButton.destructive = false


Set activationMode of your action to UIUserNotificationActivationModeForeground if you want the app to be opened by that action.