UILocalNotification when app is closed

objective-c

Solution

You have to implement `application:didFinishLaunchingWithOptions:`. The notification will be one of the options.

- (BOOL)application:(UIApplication *)application 
  didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
    if (notification) {
        // handle your notification here.
    }
}

Problem

Using the `UILocalNotification` when the app is open, this function in the app delegate is fired : ``` - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { ``` but when the app is close and not in the background, it starts the app when i hit the notification massage, but it doesnt fire this method. i need to fire it because she is the one who take me to another scene-that i need to present when someone get the notification. it works only when she is on background .

Original source