Handling Push Notifications when App is NOT running

Solution 1:

When your app is not running or killed and you tap on push notification this function will trigger;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

so you should handle it like this,

UILocalNotification *localNotif = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (localNotif) {
    NSString *json = [localNotif valueForKey:@"data"];
    // Parse your string to dictionary
}

Solution 2:

Better be if you override didReceiveRemoteNotification Here you go

NSDictionary * pushNotificationPayload = [launchOptions valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if(pushNotificationPayload) {
    [self application:application didReceiveRemoteNotification:pushNotificationPayload];
}

This will again fire the didReceiveRemoteNotification method and your push notification code will execute as same as it runs during application run time.