I have a problem when the error only occurs periodically. In fact, this seems almost random. Here, what happens, I run the 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];
}
In most cases, this works great. However, from time to time, the application crashes and causes an error "Application tried to present modally an active controller <UINavigationController>. Any ideas what I'm doing wrong here?
source
share