Last active
August 29, 2015 14:23
-
-
Save michaelochs/e172eb590540822a9534 to your computer and use it in GitHub Desktop.
Short snipped with an explanation of how your app needs to respond to local notifications.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
UILocalNotification *localNotification = launchOptions[UIApplicationLaunchOptionsLocalNotificationKey]; | |
if (localNotification) { | |
// the user opened your app by tapping either the notification banner, the notification | |
// center entry or the open action in the alert view of the notification while your app | |
// was not running / suspended. | |
// This is where you want to react to the user's action! | |
} | |
} | |
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { | |
if (application.applicationState == UIApplicationStateActive) { | |
// the notification was triggered right now and the user is currently in your app | |
// the user has not yet seen your notification as it is not shown by iOS if your app | |
// is actively running. Decide whether you want to show it yourself or if you simply | |
// want to ignore it. | |
} else { | |
// the user opened your app by tapping either the notification banner, the notification | |
// center entry or the open action in the alert view of the notification while your app | |
// was in the background. | |
// This is where you want to react to the user's action! | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment