Ios – Strange warning dismissing modal view controller

cocoa-touchiosios5ios6iphone

I'm working on iOS 6.
My application has a standard navigation controller with embedded a CustomViewController.
In this controller I create a modal view like this:

-(IBAction)presentModalList:(id)sender {
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
    StationsListViewController *list = [storyboard instantiateViewControllerWithIdentifier:@"StationsListViewController"];
    [list setStationsData: [self.stationsData allValues]];
    [self presentModalViewController:list animated:YES];
}

The modal controller show perfectly but dismissing generates a warning.
The dismiss method in this controller is:

-(IBAction)backToMap
{
    [self dismissModalViewControllerAnimated:YES];
}

The warning generated is Warning:

Attempt to dismiss from view controller < UINavigationController: 0x1ed91620 > while a presentation or dismiss is in progress!

Any clues about that?

Thanks

Best Answer

I realise this is a late answer but maybe this will help someone else looking for a solution to this, here is what I did:

-(IBAction)backToMap
{
    if (![[self modalViewController] isBeingDismissed])
        [self dismissModalViewControllerAnimated:YES];
}

For me, i found that line of code was being called multiple times, I couldn't find out why so this was the easiest fix.

Related Topic