Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:],

不羁的心 提交于 2019-11-30 18:24:53

I had to remove this line from application didFinishLaunchingWithOptions:

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

And that fixed it for me.

here i got the solution by checking if navigationController is nil or not:-

if (self.navigationController== nil)
{
    self.navigationController = [[BufferedNavigationController alloc] initWithRootViewController:self.firstViewController];
}
else
{
    [self.navigationController setViewControllers:@[self.firstViewController] animated:NO];
}

Using this row solved my issue (iOS 10):

[self.window setRootViewController:self.navigationController];

Was (worked for older iOS and Xcode):

[self.window addSubview:navigationController.view];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!