9
votes

Reading from Apple's documentation about Push Notifications:

  1. As a result of the presented notification, the user taps the action button of the alert or taps the application icon. If the action button is tapped, the system launches the application and the application calls its delegate’s application:didFinishLaunchingWithOptions: method
  2. The notification is delivered when the application is running in the foreground. The application calls its delegate’s application:didReceiveRemoteNotification: method

So my question is which delegate gets called if the application is in background state (it is running or it's suspended)? Is it application:didFinishLaunchingWithOptions: or application:didReceiveRemoteNotification:?

Please help me, thank you!

2
Apple document is not clear enoughonmyway133

2 Answers

7
votes

application:didReceiveRemoteNotification: is called when your app is in the background. This question has an answer which tells you how to tell if your app was in the background or not.

1
votes

application:didReceiveRemoteNotification: is called when your app is in the background + the message alert still active.

Once the message alert is inactive then the application will not receive any event. Do correct me if I'm wrong.