I have a push notification that I am sending to a user and I want to be able to take an action when they tap on it. I know that if the app is in the foreground, background, or if the user taps on the alert from the notification center that the following method is called in the app delegate:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
However, if the app is not launched and the user taps on a notification banner as soon as the notification arrives, this method does not seem to get called. Is their a different method that I need to impliment in this situation? Are their other cases where other methods should be implemented as well?
If you app is not launched when clicking on a notification banner, then you will receive an NSDictionary in your
application:didFinishLaunchingWithOptions:.Then you can just do something like this:
Additionally, in your
application:didReceiveRemoteNtification:method, you can test if your application was inactive at the time the notification was received, like this: