0

This is the code I have got for trying to open a view controller from a storyboard. I am getting error "expected identifier" on

UINavigationController controller = [(UINavigationController)[[mainStoryboard instantiateViewControllerWithIdentifier: @"ARViewController"];

Can someone please help.

- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL))completionHandler {

NSLog(@"%@", shortcutItem.type);
if ([shortcutItem.type isEqualToString:@"ADD OWN STRING HERE"]) {

    UINavigationController *navigationController = (UINavigationController *)self.window.rootViewController;
    UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
    UINavigationController *controller = [(UINavigationController*)[[mainStoryboard instantiateViewControllerWithIdentifier: @"ARViewController"]];
    [navigationController pushViewController:controller animated:YES];

}
}

@end
user5394344
  • 85
  • 2
  • 8

1 Answers1

0

The amount and locations of your [ and ] didn't match (two [ too many, one ] too many). It should be:

UINavigationController *controller = (UINavigationController*)[mainStoryboard instantiateViewControllerWithIdentifier: @"ARViewController"];
DarkDust
  • 90,870
  • 19
  • 190
  • 224