When I try to display a UIAlertController
from my app, the app terminates with an exception UIViewControllerHierarchyInconsistency
.
The View Controller is created with a storyboard
I create and (try to) display the Alert like this:
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Title" message:@"Message" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *yesButton = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
...
}];
[alert addAction:yesButton];
[self presentViewController:alert animated:YES completion:nil];
However, during execution I get this in the output:
2016-08-25 09:46:07.536 TrackYou[10554:3165715] *** Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'child view controller:
<
UICompatibilityInputViewController: 0x13f5afd80> should have parent view controller:<
ViewController: 0x13f549360> but requested parent is:<
UIInputWindowController: 0x140043c00>'
From the same ViewController
I use the presentViewController
to present a custom ViewController, which works fine.
SettingsViewController *controller = [SettingsViewController new];
[self presentViewController:controller animated:YES completion:nil];
Any ideas what's causing the problem?