0

I have been creating a project and I am getting a warning from the debugger:

Warning: Attempt to dismiss from view controller while a presentation or dismiss is in progress!

Here is the code:

if (self.editHw)
{
    if (self.homeworkEdit)
    {
        [self.homeworkEdit setValue:self.homeworkNameTF.text forKey:@"name"];
        [self.homeworkEdit setValue:self.subject forKey:@"subject"];
        [self.homeworkEdit setValue:self.dateDueLabel.text forKey:@"due_date"];
        [self.homeworkEdit setValue:self.reminderDateLabel.text forKey:@"reminder_date"];
        [self.homeworkEdit setValue:self.commentsTF.text forKey:@"comments"];


        NSError *error = nil;

        [context save:&error];
        [self dismissViewControllerAnimated:YES completion:nil];
    }
}

Can anyone tell me what the error means and why it is there? If you need any more info just ask.

Abdullah Shafique
  • 6,878
  • 8
  • 35
  • 70

1 Answers1

1

The code you show isn't enough to know what the error is. The error is shown because you are trying to animate 2 different view controllers at the same time (one being dismissed and one being shown). To avoide the issue you can:

1. Wait until one animation is complete before starting the next

Or

2. Run one of the changes (probably the dismissal) without animation
Wain
  • 118,658
  • 15
  • 128
  • 151