您的位置:首页 > 大数据 > 人工智能

更新Xcode7之后报错: Assertion failure

2015-12-09 00:00 423 查看
更新Xcode7之后报错:
Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3491.2.5/UIApplication.m:3173


原因:新的SDK不允许在设置rootViewController之前做过于复杂的操作,导致在didFinishLaunchingWithOptions 结束后还没有设置rootViewController。

解决办法:

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window makeKeyAndVisible];

之后直接加入代码

    UIViewController* vc = [[UIViewController alloc] initWithNibName:nil bundle:nil];
self.window.rootViewController = vc;


临时设置一个root,在之后重新对root赋值!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: