问题描述
当我的应用程序未运行并收到推送通知时,如果我单击该通知,应用程序将启动 - 但它不会通过我设置的警报视图提示用户,询问他们是否需要查看通知的内容与否.它只是启动,然后坐在那里.
When my App is not running and receives a Push Notification, if I click on that notification, the App is launched - but then it doesn't prompt the user with the Alert-View I set up, asking them whether they want to view the Notification's contents or not. It just launches, and sits there.
当应用程序运行时,推送通知可以完美运行 - 无论是作为活动应用程序还是在后台运行 - 但当应用程序未运行时,一切都无法正常工作.
The Push Notifications do work perfectly when the App is running - either as the Active app or while in the background - but nothing works correctly when the app is not running.
我尝试注销应用程序中的 launchOptions NSDictionary:didFinishLaunchingWithOptions: 以查看它带来的负载 - 但它显示为(空)".所以它基本上什么都不包含 - 这没有意义,因为它不应该包含通知的负载吗?
I tried logging-out the launchOptions NSDictionary in application: didFinishLaunchingWithOptions: to see what load its bringing - but it comes up as "(null)". So It basically contains nothing - which doesn't make sense cause shouldn't it contain the Notification's load?
有人知道如何在应用未运行的情况下在推送通知到达时使其工作吗?
Anybody have any ideas how to make Push Notifications work when they arrive while the App was NOT running?
我的意思是当应用程序处于非运行状态时如何处理推送通知.如果,如果您收到很多通知,该怎么办?您没有打开应用程序,也没有点击系统的通知面板.您如何保留这些推送以供以后检索.
I mean how to handle the Push notifications when the App is in not running state. What if, if you receive many notifications & you did not open the app, neither did you tap the system's notification panel. How are you preserving those push for a later retrieval.
推荐答案
根据您的问题,打开应用程序时无法保留所有通知,最好调用 api 以按时间戳获取所有通知从您的后端/服务器,Facebook 就是这样做的.
As per your question, there is no way to hold all the notification when you open the app, better you call an api to get all notification as per time stamp from your back end/server that's how Facebook does.
这篇关于应用终止时处理推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!