0

I am updating one of my application that uses URL Scheme. I used to have application:handleOpenURL method in appdelegate.m with following code that used to work fine from long time (without Storyboards)

 urlOpenedMsg2 *nextview=[[urlOpenedMsg2 alloc] initWithNibName:@"urlOpenedMsg2" bundle:Nil];


[self.navigationController pushViewController:nextview animated:YES];

Now I have updated my app with REFrostedViewController Sliding Menu and Story-boards. In hadleOpenURL method , I am just trying to open new screen "urlOpenedMsg2ViewController" and I can't open it.

I am using following code now

     UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

    urlOpenedMsg2ViewController *nextview = [storyboard instantiateViewControllerWithIdentifier:@"urlOpenedMsg2"];

    [(UINavigationController*)self.window.rootViewController pushViewController:nextview animated:NO];

Now my navigationViewController is not self.window.rootViewController so following line doesn't work and it opens home screen instead of urlOpenedMsg2 Screen

[(UINavigationController*)self.window.rootViewController pushViewController:nextview animated:NO]; 

Now I have RootViewController , NavigationViewController and MenuTableViewController for REFrostedViewController and RootViewController is initial view controller. Please see attached screenshot.

StoryBoards Setup

I don't know how to fix it.

How can I open "urlOpenedMsg2ViewController" screen from appdelegate.m handleOpenURL method ?

Thanks in advance.

1 Answers1

0

You need to call it like this:-

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

    urlOpenedMsg2ViewController *nextview = [storyboard instantiateViewControllerWithIdentifier:@"urlOpenedMsg2"];

    UINavigationController *navigationVC = [[UINavigationController alloc] init];

    self.window.rootViewController = navigationVC;

    [navigationVC pushViewController:nextview animated:NO];
Annie Gupta
  • 2,786
  • 15
  • 23
  • Hi, Thanks it worked. Now I can open "urlOpenedMsg2" screen. But now sliding menu button is not working on any screen. The reason is that we have changed rootViewController to navigationVC. While sliding menu works when initial View Controller is RootViewController (as shown in screenshot that I attached with original question). – Jhonny Sharma Oct 12 '16 at 04:47
  • Is there a way to make sliding menu work again after "urlOpenedMsg2" screen? – Jhonny Sharma Oct 12 '16 at 04:49
  • @JhonnySharma have you found the solution for this – Manjit Singh Jul 01 '18 at 14:12