IOS 7 error. Warning. Trying to reject a view controller. <UINavigationController: 0x1568db40> during presentation or firing.

I have a problem in iOS 7 that does not appear in iOS 6.

I have a navigation controller that displays another navigation controller for adding an employee. This second controller is modal. When I fire the second controller with either the Cancel or Finish button, I get an error. Here is the error:

QuickSchedule [880: 60b] Warning: An attempt to reject the controller during presentation or firing is in progress!

I am using unwinding and tilting from the first controller using the following appropriate code.

This is in ScheduleViewController.m (my main controller window)

- (IBAction)done:(UIStoryboardSegue *)segue
{
    if ([[segue identifier] isEqualToString:@"DoneEditing"]) {
        [[MyManager sharedManager] saveChanges];
        [self dismissViewControllerAnimated:YES completion:NULL];
    }
}

"" " → [ :]"

Xcode 5. Xcode iOS 7.

​​ , , .

EmployeeViewController AddEmployeeViewController. , AddEmployeeViewController.

EmployeeViewController.m

- (IBAction)done:(UIStoryboardSegue *)segue
{
    if ([[segue identifier] isEqualToString:@"ReturnInput"]) {
        AddEmployeeViewController *addController = [segue sourceViewController];
        if (addController.employee) {
            [[MyManager sharedManager] saveChanges];
            [[self tableView] reloadData];
        }
        if (![self.presentedViewController isBeingDismissed]) {
            [self dismissViewControllerAnimated:YES completion:nil];
        }
    }
}

- (IBAction)cancel:(UIStoryboardSegue *)segue
{
    if ([[segue identifier] isEqualToString:@"CancelInput"]) {
        [self dismissViewControllerAnimated:YES completion:NULL];
    }
}

AddEmployeeViewController.m

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([[segue identifier] isEqualToString:@"ReturnInput"]) {
        if ([self.firstNameField.text length] || [self.lastNameField.text length]) {

            Employee *newEmployee = [[MyManager sharedManager] createEmployeeWithFirstName:self.firstNameField.text andLastName:self.lastNameField.text];
            [[MyManager sharedManager] addEmployeeToList:newEmployee];
            self.employee = newEmployee;
        }
    }
}

, . " " . nil NULL . , NULL . , .

, . .

: . .

+4
5

, Xcode, , rejectViewControllerAnimated: : "done". iOS 6. , . , .

+9

iOS 7.

, (, UIAlertView ..) viewWillAppear:. , , , , UI.

viewDidAppear:, .

+6

. , , . , . dismissViewControllerAnimated:NO, , .

+2

..! apple iOS sdk... , [UIControlEventAllEvent] [UIButton], [rejectViewControllerAnimated], [UIControlEventAllEvent] , , [UIControlEventAllEvent]!! , , [UIControlEventTouchUpInside], ​​ !!!

0

Warnings of this type related to iOS7, not iOS6, occur in other situations. In my case, this was due to the dismissal of an email alert. I needed to add a conditional structure to the method below with iOS7.

- (void)didPresentAlertView:(UIAlertView *)alertView
{
    if(![[self modalViewController] isBeingDismissed])
    {
        [self dismissModalViewControllerAnimated:YES];
    }
}
0
source

All Articles