0
votes

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
1

1 Answers

0
votes

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"];