Application tried to present modally an active controller ios
Posted
by
Matthew
on Stack Overflow
See other posts from Stack Overflow
or by Matthew
Published on 2013-11-10T20:52:27Z
Indexed on
2013/11/10
21:54 UTC
Read the original article
Hit count: 2260
I was trying to set the ViewController with a parent view controller before it shows show that it can provide call backs, I done this using PrepareForSegue
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"newQuarter"])
{
[segue.destinationViewController setParentViewController:self];
}
}
It crashed giving me the error message: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally an active controller.
So I tried using another method and set up a new view controller on the button touches up,
- (IBAction) buttonClicked
{
NewViewController *newController = [[NewViewController alloc] init];
[newController setParentViewController:self];
[self presentViewController:newController animated:YES completion:nil];
}
but with no luck it is still giving me the same error message, can anyone please advice? Thanks!
© Stack Overflow or respective owner