0

In my notification did receive method, I want the app to go to the selected tab and display the root view controller of the tab.

I tried the following implementation but the selected tab did not display the root view controller. How can I make this work?

-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
    self.tabController.selectedIndex = 2; 

    //Pop View Controller to root
   [self.tabController.selectedViewController.navigationController popViewControllerAnimated:NO];     
}
Zhen
  • 12,361
  • 38
  • 122
  • 199
  • Have you checked if everything is set up or connected correctly, i.e. tabController is non-nil? Check with the debugger tabController, tabController.selectedViewController and tabCongtroller.selectedViewController.navigationController - both for non-nil and if they point to the instance you think they should. – Eiko Jul 19 '11 at 07:57

1 Answers1

0

Try

-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
    self.tabController.selectedIndex = 2; 

    //Pop View Controller to root
   [self.tabController.selectedViewController.navigationController popToRootViewControllerAnimated:NO];     
}
Rahul Vyas
  • 28,260
  • 49
  • 182
  • 256