How to let iOS 12 Notification Extension custom UI Buttons trigger the app

只愿长相守 提交于 2019-12-11 12:49:13

问题


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).



来源:https://stackoverflow.com/questions/52544222/how-to-let-ios-12-notification-extension-custom-ui-buttons-trigger-the-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!