I am trying to understand the strange behavior of my application, here is the description (verified in a trivial project).
ViewControllerA introduces modally ViewControllerB
ViewControllerB contains a button, this button represents the specified UIAlertController
alert = [UIAlertController alertControllerWithTitle:@"Test" message:nil preferredStyle:UIAlertControllerStyleActionSheet]; [alert addAction:[UIAlertAction actionWithTitle:@"Action" style:UIAlertActionStyleDefault handler:^(UIAlertAction *handler) { NSLog(@"Action"); }]];
ViewControllerB presents a warning in this way
- (IBAction)button:(id)sender { alert.popoverPresentationController.sourceView = self.button; alert.popoverPresentationController.sourceRect = self.button.bounds; [self presentViewController:alert animated:YES completion:nil]; }
Now, if you click on the button, a warning will appear; if you click outside the warning, the warning will disappear (I'm on an iPad). You can do this as many times as you want ...
Here is the error. When a warning is displayed, if you press outward twice (fast enough, ~ 0.2 s interval), the warning disappears AND the ViewControllerB is rejected . At the end, we see ViewControllerA, but we never asked for it.
There is also a warning message:
Warning: Attempt to dismiss from view controller <UIViewController: 0x7f85ab633f70> while a presentation or dismiss is in progress!
Thank you for your help.
ios objective-c uialertcontroller
Paul v
source share