When user launch app via notification, it may have different scenarios:
it wasn't launched, then app launching in default way and you can handle notification in such way:
-(BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UILocalNotification *remoteNotif =
[launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (remoteNotif) {
//handle remote notification
}
....
}
if app was in background or foreground, called delegate method
- application:didReceiveRemoteNotification: {
if (application.applicationState == UIApplicationStateActive){
//application was in foreground
} else if (application.applicationState == UIApplicationStateInactive){
//application was in background
}
}
Also, if application was in foreground - system does not show alerts, don't change badge icon or playback sound - you should handle notification completely by yourself