在iOS上,我的应用程序如何获取手机在后台时收到的通知数据? [英] On iOS, how can my app get the notification data that it received while the phone was in the background?

查看:172
本文介绍了在iOS上,我的应用程序如何获取手机在后台时收到的通知数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AppDelegate中是否可以获取所有通知数据的队列? (一旦用户打开应用程序).

Is there a way in AppDelegate to get a queue of all the notification data? (Once the user opens the app).

推荐答案

根据Apple文档:

当远程通知到达时,系统调用application:didReceiveRemoteNotification:fetchCompletionHandler:方法.通知通常表示新信息的可用性.在您的应用程序委托方法中,您可能会开始从服务器下载新数据,以便可以更新应用程序的数据结构.您还可以使用通知来更新用户界面.

When a remote notification arrives, the system calls the application:didReceiveRemoteNotification:fetchCompletionHandler: method. Notifications usually signal the availability of new information. In your app delegate method, you might begin downloading new data from a server so that you can update your app’s data structures. You might also use the notification to update your user interface.

您必须启用remote notification background mode,只有这样才能获得上述方法的回调.

You have to enable remote notification background mode, only then you will get a callback to the above mentioned method.

这篇关于在iOS上,我的应用程序如何获取手机在后台时收到的通知数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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