简体   繁体   中英

IOS notification content extension: add buttons in storyboard and handle the click action

IOS通知内容扩展:在MainInterface.storyboard中添加按钮,处理点击动作而不解除通知

after making some research I discover that: can not handle buttons clicks in the IOS notification content extension, only the type of button can be used is the media button, see the IOS documentation:

https://developer.apple.com/documentation/usernotificationsui/unnotificationcontentextension

上面的答案是不正确的,你可以在info.plist中添加UNNotificationExtensionUserInteractionEnabled YES,然后你就可以像普通的viewController一样做每件事

As Abdullah S. Al-Hallak said, it is not possible to perform actions that will lunch a certain screen. In Apple documentation , it is mentioned that "Do not install gesture recognizers or rely on touch events in your interface."

The only possible way is to add actions that will do some things in the presented notification only (like animation, as presented in this cool post: Adding a Custom UI and Interactivity in Local and Push Notifications )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM