iOS 6: update view after push notification was received, but app was closed

被刻印的时光 ゝ 提交于 2019-12-05 12:27:22

From the APNS development guide :

Let’s review the possible scenarios when the operating delivers a local notification or a remote notification for an application.

The notification is delivered when the application isn’t running in the foreground. In this case, the system presents the notification, displaying an alert, badging an icon, perhaps playing a sound.

As a result of the presented notification, the user taps the action button of the alert or taps (or clicks) the application icon. 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.

The behavior you are experiencing is the expected behavior when tapping the app icon. In this case, it's as if the user started the app normally and no push notification arrived. The only way (I can think of) for you to display something different in this case is to contact your server at the launch of your application and get some information that indicates a push notification was recently sent to that device.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!