首页 > 升级到Xcode7后出现没设置rootViewController错误

升级到Xcode7后出现没设置rootViewController错误

报错信息如下:
exception:Application windows are expected to have a root view controller at the end of application launch

代码如下:
self.window.rootViewController = self._tabBarController;
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];

升级前都正常使用,升级后报错,求大神


NSArray windows = [[UIApplication sharedApplication] windows];
for(UIWindow *window in windows)
{
NSLog(@"window: %@",window.description);
if(window.rootViewController == nil)
{
UIViewController vc = [[UIViewController alloc]initWithNibName:nil bundle:nil]; window.rootViewController = vc;
}

我得代码


你确定你的 self._tabBarController 不是 nil ?


同求,8.4没问题,9.0就报错exception:Application windows are expected to have a root view controller at the end of application launch

【热门文章】
【热门文章】