【发布时间】:2015-01-13 03:31:59
【问题描述】:
我正在尝试在我的 iOS 应用程序中从 AppDelegate 提供UIAlertController。
下面是警报和当前方法。
UIAlertController *alert = [UIAlertController alertControllerWithTitle:cTitle message:cMessage preferredStyle:UIAlertControllerStyleAlert];
//Configure alert and actions
[self.window.rootViewController presentViewController:alert animated:TRUE completion:nil];
但是,当我尝试显示警报时,它没有出现,并且我在控制台中收到以下警报。
Warning: Attempt to present <UIAlertController: 0x145f5d60> on <UINavigationController: 0x146590f0> whose view is not in the window hierarchy!
是什么导致了错误,我该如何解决?
【问题讨论】:
-
我猜想在应用程序启动时正确呈现?
-
你可以试试这个链接有用吗链接:[ alertViewController](stackoverflow.com/a/37029075/2442762)
标签: ios objective-c appdelegate uialertcontroller