1

enter link description hereI run my project in xocde 6.4 successfully,when I updated to Xcode7 Im getting error at launch.

[UIApplication _runWithMainScene:transitionContext:completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3505.16/UIApplication.m:3294 2015-09-19 12:16:48.889 OrderEm[4102:68071] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'

  -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
 self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]autorelease];


 Login *login=[[[Login alloc]initWithNibName:@"Login~iPad" bundle:nil]autorelease];

        [self.window setRootViewController:login];
       // self.window.rootViewController = login;
        [self.window makeKeyAndVisible];

        return YES;
 }

My login view didload and viewwillappear methods called after that getting this crash.

siva krishna
  • 1,149
  • 2
  • 15
  • 23
  • Having same issue on update, find anything out? – Mike Flynn Sep 20 '15 at 03:44
  • It seems only occuring some times – siva krishna Sep 21 '15 at 04:34
  • NSArray *windows = [[UIApplication sharedApplication] windows]; for(UIWindow *window in windows) { NSLog(@"window: %@",window.description); if(window.rootViewController == nil){ UIViewController* vc = [[UIViewController alloc]initWithNibName:nil bundle:nil]; window.rootViewController = vc; } Its worked for me ... – siva krishna Sep 21 '15 at 06:06
  • 1
    Possible duplicate of ["Application windows are expected to have a root view controller at the end of application launch" error when running a project with Xcode 7, iOS 9](http://stackoverflow.com/questions/30884896/application-windows-are-expected-to-have-a-root-view-controller-at-the-end-of-a) – lipka Nov 27 '15 at 14:06

2 Answers2

3

This fixed it for me

Applications are expected to have a root view controller at the end of application launch

Community
  • 1
  • 1
Mike Flynn
  • 22,342
  • 54
  • 182
  • 341
0

I have encountered this error, returns this error in the simulator, there is no problem on the real machine.

*** Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3505.16/UIApplication.m:3294