ios – 当我的应用程序处于后台时,仅当我触摸顶部通知横幅时才会处理推送通知

我已经实施了
application:didReceiveRemoteNotification:

在收到推送通知时将数据存储在我的应用程序中.

但是,当我的应用程序处于后台并且收到通知时,仅当我触摸顶部显示通知横幅时才会存储数据:

相反,如果我触摸应用程序图标以重新打开它,则不会存储通知内容

由于我仅在使用分发配置文件时才收到通知,因此我不确定应用程序:didReceiveRemoteNotification:仅当我将通知横幅推到顶部时才会调用.

我认为它总是在收到通知调用,而不是在用户对设备执行操作后调用.

UPDATE.
我不知道这是否有用,但是,只是为了让你知道,我还没有实现任何这些方法

– applicationDidEnterBackground:
– applicationWillEnterForeground:
- applicationDidBecomeActive:

解决方法

我想我已经找到了原因.从文档:

If the action button is tapped (on a device running iOS),the system
launches the application and the application calls its delegate’s
application:didFinishLaunchingWithOptions: method (if implemented); it
passes in the notification payload (for remote notifications) or the
local-notification object (for local notifications).

If the application icon is tapped on a device running iOS,the
application calls the same method,but furnishes no @R_209_4045@ion about
the notification.

http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/IPhoneOSClientImp/IPhoneOSClientImp.html

但是,我想知道是否有办法加载有效负载,即使应用程序已通过触摸图标重新打开.

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...