Home > DeveloperSection > Forums > How to navigate through notification
Steven Hill
Steven Hill

Total Post:10

Points:72
Posted on    November-28-2015 1:11 AM

 iPhone iPhone  Ios  Objective C 
Ratings:


 1 Reply(s)
 362  View(s)
Rate this:
I want to navigate on specific screen on tapping notification,
I tried by using alert key but it will not work after closing application.
Please help me.


Tarun Kumar

Total Post:210

Points:1614
Posted on    December-08-2015 11:34 PM

If you want to navigate on another app through the notification, use these methods didFinishLaunchingWithOptions: , didReceiveRemoteNotification: from your app delegate; use this example:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:
                                                 (NSDictionary *)launchOptions {
   self.window.rootViewController = self.tabBarController;
   [self.window makeKeyAndVisible];

   // If application is launched due to  notification, present another view controller.
   UILocalNotification *notification = [launchOptions objectForKey:
                                        UIApplicationLaunchOptionsRemoteNotificationKey];
   if(notification) {
      NotificationViewController *viewController = [
                                        [NotificationViewController alloc]initWithNibName:
                                         NSStringFromClass([NotificationViewController class])
                                         bundle:nil];
      [self.window.rootViewController presentModalViewController:
                                         viewController animated:NO];
      [viewController release];
   }
   return YES;
}

 -(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
NotificationViewController *viewController = [[NotificationViewController alloc]initWithNibName:NSStringFromClass([NotificationViewController class]) bundle:nil];
   [self.window.rootViewController presentModalViewController:viewController animated:NO];
   [viewController release];
}


Don't want to miss updates? Please click the below button!

Follow MindStick