Application tried to present modally an active controller: uinavigationcontroller
ios, iphone, objective-c, uistoryboard
Solution
Try instantiating the controller that is embedded in your navigation controller in your storyboard, then create a new instance of a generic navigation controller:
HICompseController *controller = [sb instantiateViewController:
HIComposeMessageViewController];
UINavigationController *nav = [[UINavigationController alloc]
initWithRootViewController:controller];
[self presentViewController:nav animated:YES completion:nil];
Problem
I'm running into an issue where an error is only raised periodically. In fact it seems almost random. Here's what happens, I'm launching a modal view controller with the following code: ``` - (void)createMessageClicked { UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Channel" bundle:nil]; UINavigationController *nav = [sb instantiateViewControllerWithIdentifier:@"HIComposeMessageNavController"]; HIComposeMessageViewController *vc = [[nav viewControllers]objectAtIndex:0]; vc.channel = [self.channels objectAtIndex:0]; [self.navigationController presentViewController:nav animated:YES completion:nil]; } ``` Most of the time, this works fine. However once in a while the app crashes and raises the error `"Application tried to present modally an active controller <UINavigationController>`. Any ideas what I'm doing wrong here?