iOS调试技巧

Assertion failure in -[UIApplica

2015-09-19  本文已影响943人  _会飞的鱼

更新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];

之后直接加入代码

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

临时设置一个root,在之后重新对root赋值

上一篇 下一篇

猜你喜欢

热点阅读