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?
- 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 anon-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