问题描述
测试地理位置。当在系统设置-隐私-定位服务 关闭的时候,打开app,会直接弹出
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
*** First throw call stack:
(0x18349d900 0x182b0bf80 0x18349d7d0 0x183e1099c 0x188438ac0 0x1884355c0 0x184a53790 0x184a53b10 0x183454efc 0x183454990 0x183452690 0x183381680 0x1881fe580 0x1881f8d90 0x10032171c 0x182f228b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
上网查找大部分说在 app delegate 中设置 一个rootview,但是我是设置好的,在定位服务打开的时候是正确的。 问题出在定位服务这里。
后来拆分代码,调试发现是在 自动登入的时候发生这个错误的。
错误代码:
[HttpRequestManager LoginBackGround:dic complete:^(NSData *data) {
if ([[LoginUserMode user] loginwithData:data]) {
[[LoginUserMode user] setOrigin:type];
[self TurnToTaskViewControll];
}else{
dispatch_async(dispatch_get_main_queue(), ^{
[self TurnToWelcomControll];
});
}
} failed:^{
[self TurnToWelcomControll];
} ];
走的是if里面的,灵光一线,莫非是在线程里面跳转了?
在里面加入了主线程。
dispatch_async(dispatch_get_main_queue(), ^{
[self TurnToTaskViewControll];
});
成功运行。
问题解决了但是遗留了问题。这跟定位服务有关系吗?