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 information about
the notification.
但是,我想知道是否有办法加载有效负载,即使应用程序已通过触摸图标重新打开.