[转]application windows are expected to have a root view controller错误
2014-06-15 22:47
295 查看
转载地址:http://blog.sina.com.cn/s/blog_6784e6ea01017jfy.html
最新更正:这个提示几乎不影响编译和运行,可以不用设置。
产生这个提示的操作:在xcode4.6中创建一个名字为appTest空工程,create一个ios-application-empty application,直接编译运行
错误提示:虽然编译通过,也能运行,但是底下有错误提示“application windows are expected to have a root view controller”
原因:在较新的xcod上都会出现这种错误。在iOS5之前的版本,应用加载时,需要一个root view controller,在iOS5以下的版本会有MainWindow作为启动文件,iOS5以后的版本没有了。需要手动创建一个root view controller
解决:
①创建一个类file - new file - object-c class,名字myViewController,继承于UIViewController
②在testAppDelegate.h中添加属性viewController,代码如下:
@property (strong, nonatomic) myViewController* viewController
③在testAppDelegate.m中初始化viewController并赋值给rootViewController
self.viewController = [[ViewController alloc] initWithNibName:@"myViewController" bundle:nil];
self.window.rootViewController = self.viewController;
再次编译运行已经没有错误了。
最新更正:这个提示几乎不影响编译和运行,可以不用设置。
产生这个提示的操作:在xcode4.6中创建一个名字为appTest空工程,create一个ios-application-empty application,直接编译运行
错误提示:虽然编译通过,也能运行,但是底下有错误提示“application windows are expected to have a root view controller”
原因:在较新的xcod上都会出现这种错误。在iOS5之前的版本,应用加载时,需要一个root view controller,在iOS5以下的版本会有MainWindow作为启动文件,iOS5以后的版本没有了。需要手动创建一个root view controller
解决:
①创建一个类file - new file - object-c class,名字myViewController,继承于UIViewController
②在testAppDelegate.h中添加属性viewController,代码如下:
@property (strong, nonatomic) myViewController* viewController
③在testAppDelegate.m中初始化viewController并赋值给rootViewController
self.viewController = [[ViewController alloc] initWithNibName:@"myViewController" bundle:nil];
self.window.rootViewController = self.viewController;
再次编译运行已经没有错误了。
相关文章推荐
- application windows are expected to have a root view controller错误
- application windows are expected to have a root view controller错误
- application windows are expected to have a root view controller错误
- 关于Application windows are expected to have a root view controller at the end of application launch
- “Application windows are expected to have a root view controller at the end of application launch”
- Application windows are expected to have a root view controller at the end of appliaction launch.
- application windows are expected to have a root view controller
- Application windows are expected to have a root view controller at the end of application launch
- Application windows are expected to have a root view controller at the end of application launch问题分析
- iOS每次启动都提示:Application windows are expected to have a root view controller at the end of application
- Application windows are expected to have a root view controller at the end of application launch
- iOS 9出现错误Applications are expected to have a root view controller at the end of application launch
- Application windows are expected to have a root view controller at the end of application launch
- Application windows are expected to have a root view controller at the end of application launch'
- 'Application windows are expected to have a root view controller at the end of application launch' [
- Application windows are expected to have a root view controller at the end of application launch解决方法
- Application windows are expected to have a root view controller at the end of application launch
- Application windows are expected to have a root view controller at the end of appliaction launch.
- 在写引导页面时,出现Application windows are expected to have a root view controller at the end of application
- 'Application windows are expected to have a root view controller at the end of application launch'