装了新xcode后,无意中发现会报错,崩溃。查资料和看英语,终于找到解决方法。
错误:
Xcode7 7.1出现:
a.2015-11-05 11:57:29.057 test[1729:59405] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
从iOS9开始,Xcode7.Xcode7.1需要所有UIWindow必须有一个rootViewController,否则报以上两点之一错误。
解决办法:
//uiControlView 名字可以随便换
UIViewController *uiControlView = [[UIViewController alloc] init];self.window.rootViewController = uiControlView;
[self.window makeKeyAndVisible];
添加红色的那两行就可以,xcode7,7.1都是这样。