Application windows are expected to have a root view controller at the end of application launch – even with all known issues fixed

I have this problem, however none of the information I can find on this forum or the internet in general seems to be able to help me.

There seem to be two places where this error can come about:

  • UILabel text not changing, however xx.title is working
  • XCode 4.5 (4G182) + iPhone 5 iOS6 - Choose a destination with a supported architecture in order to run on this device
  • CustomTableCellView's implementation of -layoutSubviews needs to call super , NSInternalInconsistencyException
  • Error to present view controller centered in iPad iOS 6
  • Capture panorama image from iPhone camera in ios6
  • Xcode 4.5.1 get stuck when archiving
    1. main.m – my function looks like this:
      int main(int argc, char *argv[])
        {
            @autoreleasepool {
                return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
            }
        }
    

    The last argument in UIApplicationMain returns an NSString value of the class of my AppDelegate. This is therefore working fine.

    2.AppDelegate.m – there is an “older” way of setting the root view controller which is like this:

      [self.window addSubview:rootViewController];
    

    However, in my app it has already been updated to:

    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    

    So none of the current information on the internet works. It is slightly more puzzling as my colleague can get it to work on his computer perfectly fine – he was the one that sent me the app source code so all the settings and code should be exactly the same.

    I am trying to launch this in the simulator. It is built against iOS 5, but I’m trying to run it on the iOS 6.0 simulator.

    I have the latest XCode (4.5.1).

    Is there any reason this would be happening? And how can I rectify it?

    Many thanks

    Tom

    4 Solutions Collect From Internet About “Application windows are expected to have a root view controller at the end of application launch – even with all known issues fixed”

    I ran into exactly the same thing trying to add a UITableView to a single-view app. Instead, create a default Master-Detail Application project (file->new->target->…) and see the AppDelegate’s implementation of didFinishLaunchingWithOptions:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    
    MDMasterViewController *masterViewController = [[MDMasterViewController alloc] initWithNibName:@"MDMasterViewController" bundle:nil];
    self.navigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];
    self.window.rootViewController = self.navigationController;
    [self.window makeKeyAndVisible];
    return YES;
    }
    

    Rather than directly setting your view controller as the window’s rootViewController, you need to create a navigation controller init’ed with your view controller for initWithRootViewController, then set that nav controller as the window’s rootViewController. (Notice you also have to squirrel away that nav controller in a property so it doesn’t get destructed).

    Just change this:

    [window addSubview:tabBarController.view];
    

    to this:

    [window setRootViewController:tabBarController];
    

    Or whatever was in the addSubView:

    Try to define the default view controller in your project menu,

    select your project => Summary => Main Interface => Type your main view controller

    every time that i started new project i faced the same error as you,doing this every time solved,hope this help you.

    Do the following add an Exception BreakPoint on your code at least to see if you can figure out what’s the problem. Use this tutorial if you don’t know how to do it. Also, are there any warnings when you compile? Even if it let’s you compile, sometimes warnings can reveal why your app is crashing.