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

前端 未结 3 913
鱼传尺愫
鱼传尺愫 2021-01-04 14:28

I am getting the following error in iOS9 only.

Here is my code:-

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDi         


        
相关标签:
3条回答
  • 2021-01-04 15:00

    I had to remove this line from application didFinishLaunchingWithOptions:

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

    And that fixed it for me.

    0 讨论(0)
  • 2021-01-04 15:14

    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];
    
    0 讨论(0)
  • 2021-01-04 15:17

    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];
    }
    
    0 讨论(0)
提交回复
热议问题