I have an app that's live and it's experiencing a very small number of crashes. The crashes are throwing an NSInvalidArgumentException with the message "Application tried to present modally an active controller <UIAlertController: 0x122867800>."
I use a UIAlertController in a few places, but they all fit the same usage pattern below where self is a UIViewController:
After spending a lot of time looking through the code, debugging, and looking for others with the same issue, I guess I have 2 questions:
Any thoughts or feedback on this are appreciated! Thanks!
I use a UIAlertController in a few places, but they all fit the same usage pattern below where self is a UIViewController:
Code Block obj-c UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"..." message:@"..." preferredStyle:UIAlertControllerStyleAlert]; [self presentViewController:alert animated:YES completion:nil];
After spending a lot of time looking through the code, debugging, and looking for others with the same issue, I guess I have 2 questions:
What I *think* this error message is trying to tell me is that I'm trying to present the same active view controller instance on itself -- that I have a pointer to a view controller, it's already displayed modally, and I'm trying to display the same view controller again. In this scenario that's not true. Is there something I'm not understanding about the error message? Is it trying to tell me something different?
The exception traces don't contain much helpful information and I haven't been able to reproduce this on a device or simulator. Does anyone have advice for tracking down this sort of exception?
Any thoughts or feedback on this are appreciated! Thanks!