Xcode7.2.1报错:Application windows are expected to have a root view controller at the end of application launch

原因:在较新的xcod上都会出现这种错误。在iOS5之前的版本,应用加载时,需要一个root view controller,在iOS5以下的版本会有MainWindow作为启动文件,iOS5以后的版本没有了。需要手动创建一个root view controller。

添加如下代码即可:

self.window.rootViewController = [[UIViewController alloc]init];

posted @ 2016-03-09 08:08  libinwanzi  阅读(176)  评论(0编辑  收藏  举报