If the application does not start when you click on the notification banner, you will get an NSDictionary in application:didFinishLaunchingWithOptions:
Then you can just do something like this:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSDictionary *pushDict = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]; if(pushDict) { [self application:application didReceiveRemoteNotification:pushDict]; } }
Also, in your application:didReceiveRemoteNtification: you can check to see if your application was inactive at the time you received the notification, for example:
-(void)application:(UIApplication *)app didReceiveRemoteNotification:(NSDictionary *)userInfo { if([app applicationState] == UIApplicationStateInactive) { NSLog(@"Received notifications while inactive."); } else { NSLog(@"Received notifications while active."); }
source share