应用程序终止时处理推送通知 [英] Handling Push Notifications when App is Terminated

查看:79
本文介绍了应用程序终止时处理推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我的应用程序没有运行并收到推送通知时,如果我点击该通知,则会启动应用程序 - 但是它不会提示用户设置了警报视图,询问他们是否需要查看通知的内容与否。它刚刚启动,并且就在那里。

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:看看它带来了什么加载 - 但它出现了(null )。所以它基本上什么也没有 - 这是没有意义的,因为它不应该包含Notification的负载吗?

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?

任何人都有任何想法如何使Push Notifications在到达时工作应用程序没有运行?

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.

这篇关于应用程序终止时处理推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆