Best place to handle user tapping on a remote push notification

I was going through some Apple Docs, and read the following:


" Let’s review the possible scenarios that can arise when the system delivers a local notification or a remote notification for an app.


The user taps the default button in the alert or taps (or clicks) the app icon. If the default action button is tapped (on a device running iOS), the system launches the app and the app calls its delegate’s

application:didFinishLaunchingWithOptions:
method, passing in the notification payload (for remote notifications) or the local-notification object (for local notifications). Although
application:didFinishLaunchingWithOptions:
isn’t the best place to handle the notification, getting the payload at this point gives you the opportunity to start the update process before your handler method is called.

If the notification is remote, the system also calls

application:didReceiveRemoteNotification:fetchCompletionHandler:
. "



It looks like the above document is partially true. If the app is in the background (multitasking menu), then the system only calls

application:didReceiveRemoteNotification:fetchCompletionHandler, however, if the app is killed (and not in background), then the system only calls application:didFinishLaunchingWithOptions.


Is this expected behavior? If it is, should we be handling what we want to do when the user taps on the notification at 2 different places?

I am having similar problems, I want different behavior if the user taps the outside-the-app notification, but it doesn't seem possible to determine this case.

Has anyone figured this out? I have been having similar problems and I can't find a proper solution anywhere.

Best place to handle user tapping on a remote push notification
 
 
Q