1
  1. An app is running on iPhone and user tap the home button once and app will enter background.
  2. after 2 or 3 seconds local notification arrives and user tap on local notification.
  3. app will again enter in foreground and become active and didReceiveLocalNotification will be called.

How to determine that app become active by tapping on local notification not the app icon.

S.J
  • 3,063
  • 3
  • 33
  • 66
  • This looks like a possible dupe of http://stackoverflow.com/questions/32061897/ios-push-notification-how-to-detect-if-the-user-tapped-on-notification-when-the – Guy Lowe Jun 20 '16 at 04:48

1 Answers1

1

Here is an easy way to detect what's your App's status when UILocalNotification fired and if
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
is called, this makes sure that local notification is received.

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
    UIApplicationState state = [application applicationState];
    if (state == UIApplicationStateInactive) {
        // Application was in the background when notification was delivered.
    } else {

    }
}
Aamir
  • 16,329
  • 10
  • 59
  • 65