Handling Remote Notifications

余生颓废 提交于 2019-12-02 00:21:17

问题


I was reading how handling remote notification on developer apple guide. My questions are two: what is the interpretation of the phrase

The notification is delivered when the application isn’t running in the foreground

isn’t running in the foreground covers background and not running or in the background state just. Based on the interpretation, the following sentence:

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

has a different sense.

The second question concerns the situation where I get two consecutive remote notifications: When I open the app in the method

application:didFinishLaunchingWithOptions: or application:didReceiveRemoteNotification:

I have information on all notifications or just the last?


回答1:


  • If your application is running, either in background suspended state or foreground, the method that will get called upon receiving a notification will always be application:didReceiveRemoteNotification:.
  • If your application is not running at all, upon launch after receiving a notification, it will trigger application:didFinishLaunchingWithOptions: and the options will be a non-nil object containing information about your remote notification.
  • As far as I know, only the last notification info is available.


来源:https://stackoverflow.com/questions/10335762/handling-remote-notifications

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