I have created my own Notification Extension custom UI with iOS 12 and added 2 buttons in it. Now I want to tap any of the buttons to launch the app with the app being aware of which buttons was tapped. My problem is, either the notification-extension captures the tapping of button but stays in the custom UI without launching the app, or it does not capture the tapping of button while being able to launch the app. Is there any solution then? Thanks!
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Now I want to tap any of the buttons to launch the app with the app being aware of which buttons was tapped
Your button inside the interface can summon the app by telling the extension context to performNotificationDefaultAction
, but this is no different from the user tapping on the background of the interface.
If you really need a button that summons the app and identifies itself to the app, you need to use an action button (a UNNotificationAction).