如何控制推送通知中的按钮? [英] How to control what the buttons in push notifications do?
问题描述
我可以向iOS设备发送推送通知。通知上有一个关闭按钮和一个查看按钮。当用户点击查看按钮时,应用程序将打开根视图控制器。在应用程序内有一个新闻部分。假设通知是提醒用户有新的新闻故事可供他们查看。如果他们点击查看,根视图控制器将显示,而不是新闻视图控制器。我该如何打开新闻视图控制器? Facebook使用了很多。这会在服务器上还是在应用程序中进行更改?感谢您的帮助!
I'm able to send push notifications to iOS devices. There is a "Close" button on the notification and a "View" button. When the user hits the "View" button the app opens up to the root view controller. Within the app there is a news section. Let's say the notification is to alert the user that there is a new news story for them to see. If they hit "View", the root view controller will show, instead of the news view controller. How would I go about opening the news view controller? Facebook uses this a lot. Would this be something to change on the server or within the app? Thanks for your help!
推荐答案
您必须检查应用程序代理中的启动选项:
You have to check the launch options in your application delegate:
application:didFinishLaunchingWithOptions
在那里你可以获取推送通知的有效负载字典。
There you can obtain the payload dictionary of the push notification.
这篇关于如何控制推送通知中的按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!