相关疑难解决方法(0)

尝试在UIViewController上呈现UIViewController,其视图不在窗口层次结构中

刚开始使用Xcode 4.5,我在控制台中遇到了这个错误:

警告:尝试在<ViewController:0x1ec3e000>上显示<finishViewController:0x1e56e0a0>,其视图不在窗口层次结构中!

该视图仍在呈现中,应用程序中的所有内容都正常运行.这是iOS 6中的新功能吗?

这是我用来在视图之间切换的代码:

UIStoryboard *storyboard = self.storyboard;
finishViewController *finished = 
[storyboard instantiateViewControllerWithIdentifier:@"finishViewController"];

[self presentViewController:finished animated:NO completion:NULL];
Run Code Online (Sandbox Code Playgroud)

cocoa-touch views hierarchy ios ios6

573
推荐指数
11
解决办法
35万
查看次数

如何从Appdelegate展示UIAlertController

我在iOS应用程序上使用PushNotification.我想在应用收到通知时显示UIalertcontroller.

我在AppDelegate中尝试以下代码:

[self.window.rootViewController presentViewController:alert animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

但是UIAlertcontroller正在根视图(第一个屏幕)中显示,而对于其他uiviewcontroller,我收到警告或应用程序崩溃.

iphone objective-c ios uialertcontroller swift3

30
推荐指数
4
解决办法
2万
查看次数