操作按钮在前台显示应用程序

Action button show app on foreground

如果我点击通知,它会打开应用程序,但是当我向通知添加按钮时,用户按下按钮应用程序停留在后台,我想要与点击通知相同的操作(打开前端的应用程序)

可能吗?

已解决!感谢您的回答:

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

如果您希望通过该操作打开应用程序,请将您的操作的 activationMode 设置为 UIUserNotificationActivationModeForeground