當我嘗試從我的應用程序中顯示UIAlertController
時,應用程序終止,並出現異常UIViewControllerHierarchyInconsistency
。UIViewControllerHierarchyInconsistency當顯示UIAlertController時出現異常
視圖控制器與故事板
創建和(嘗試)顯示警報這樣創建:
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];
然而,在執行過程中我得到這個在輸出:
2016-08-25 09:46:07.536 TrackYou [10554:3165715] *** Terminati NG應用程序由於未捕獲的異常 'UIViewControllerHierarchyInconsistency',理由是: '子視圖控制器:
<
UICompatibilityInputViewController:0x13f5afd80>應該有父視圖控制器:<
的ViewController:0x13f549360>,但要求家長爲:<
UIInputWindowController:0x140043c00>'
從相同的ViewController
我使用presentViewController
來呈現一個自定義ViewController,它工作正常。
SettingsViewController *controller = [SettingsViewController new];
[self presentViewController:controller animated:YES completion:nil];
任何想法是什麼原因造成的問題?
可能欺騙http://stackoverflow.com/questions/24029113的/ error-when-adding-input-view-to-textfield-ios-8 .. – vaibhav