Note that there are some explanatory texts on larger screens.

plurals
  1. POPush view from push notification
    primarykey
    data
    text
    <p>I receive my notifications successfully for iOS 5. I want to be able send users to a specific view when they swipe or tap the push notification in the notification centre.</p> <p>The view controller (view) I want the user to go to opposed to just the start of my app is the "groceryStoreViewController". I have read that this is done in didFinishLaunchingWithOptions or didReceiveRemoteNotification but I am not sure.</p> <p>If anyone knows how to do this, I would really appreciate it since it has really been a struggle.</p> <p>Thanks</p> <p><strong>EDIT</strong></p> <p>So the issue is that I want a specific view controller to be opened when the user taps a notification but I also want the UITabBar to remain. I have not successfully been able to do this and it has something to do with me displaying the subview I believe. Please let me know what you think and thank you so much.</p> <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.tabBarItem = [[[UITabBarItem alloc] init] autorelease]; exploreViewController *view1 = [[exploreViewController alloc] initWithNibName:@"exploreViewController" bundle:nil]; view1.title= @"Explore"; Upcoming *view2 = [[Upcoming alloc] initWithNibName:@"Upcoming" bundle:nil]; view2.title = @"Upcoming"; TipsViewController *view3 = [[TipsViewController alloc] initWithNibName:@"TipsView" bundle:nil]; view3.title = @"Tips"; UINavigationController *nav1 = [[UINavigationController alloc] initWithRootViewController:view1]; UINavigationController *nav2 = [[UINavigationController alloc] initWithRootViewController:view2]; UINavigationController *nav3 = [[UINavigationController alloc] initWithRootViewController:view3]; [view1 release]; [view2 release]; [view3 release]; self.tabBarController = [[[UITabBarController alloc] init] autorelease]; self.tabBarController.viewControllers = [NSArray arrayWithObjects:nav1,nav2,nav3,nil]; self.tabBarItem = [[[UITabBarItem alloc] init] autorelease]; [nav1 release]; [nav2 release]; [nav3 release]; if (launchOptions != nil) { NSDictionary *remoteNotif = [launchOptions objectForKey: UIApplicationLaunchOptionsRemoteNotificationKey]; NSLog(@"Launched from push notification"); //Accept push notification when app is not open if (remoteNotif) { NSDictionary *alertBody = [remoteNotif objectForKey:@"loc-key"]; self.window.rootViewController = nav2; //this is what I want displayed when tapped but also maintain tab bar controller [window addSubview:tabBarController.view]; [window makeKeyAndVisible]; } } else { //Go here if just loading up normally without push [window addSubview:tabBarController.view]; [window makeKeyAndVisible]; } return YES; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload