1

I've upgraded my XCode to 4.5.1 in order to debug in my new iPad with IOS 6.0.1. After that I get this error on console after compiling:

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

And my application enters in a screen different from the main and the buttons do not work at all.

In the older version of XCode it worked as a charm.

Any ideas of what is happening?

On the app delegate I have this:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    // Override point for customization after application launch.

    // Add the view controller's view to the window and display.


    [self.window addSubview:viewController.view];

    [self.window makeKeyAndVisible];

    return YES;
}

Just to update, the only way I could get my app again was to delete Xcode 4.5.1 and go back to Xcode 4.4.1. There seems to be a problem in the .xib file and interface builder cannot link properly the objects in the newest versions. I don't know why

A funny fact, before I updated the XCode i could not run my app on the ipad with ios 6.0.1(I was compiling for IOS 5.1) After the downgrade it works.

Zoukar
  • 13
  • 4
  • 2
    You could post the lines in didFinishLaunching in your app delegate for starters... – Jonny Nov 05 '12 at 12:39
  • There are [quite a few questions](http://stackoverflow.com/search?q=Applications+are+expected+to+have+a+root+view+controller+at+the+end+of+application+launch) that cover this subject here on SO. Doesn't any of those answer your question? – Matej Bukovinski Nov 05 '12 at 13:05

1 Answers1

1

Go to AppDelegate class and add:

self.window.rootViewController = self.viewController;
Midhun MP
  • 103,496
  • 31
  • 153
  • 200
  • 1
    Why is this voted down? Without any further information from TS, this sounds like a reasonable answer. – Martol1ni Nov 05 '12 at 12:47
  • 1
    I've have seen this on another question, but the problem is that even doing that it won't work. I don't know why. – Zoukar Nov 05 '12 at 12:59
  • Make sure self.viewController is not nil. This needs to be a reference (i.e., IBOutlet to your root controller). – Matej Bukovinski Nov 05 '12 at 13:04
  • @Zoukar: where did you add this line ? add this line before calling `[self.window makeKeyAndVisible];` – Midhun MP Nov 05 '12 at 13:04
  • Yes i've called it before [self.window makeKeyAndVisible];. I've also double checked to see if the viewController was correctly referenced on the Interface Builder. I have the same results. – Zoukar Nov 05 '12 at 13:14
  • just one more tweak: write these codes too `self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];` – Midhun MP Nov 05 '12 at 13:16
  • Sorry, but it didn't work. For some reason my Xcode gets another view and get stuck in it. That message continues to appear. – Zoukar Nov 06 '12 at 13:26
  • after allocating the window and viewController you are getting the same issue ? I think then there will be some issue with the viewController code – Midhun MP Nov 06 '12 at 13:33
  • Yes after that, I was debuging the viewController to see if there was a problem, but apparently it is working fine... This app has like one year and worked flawlessly until I upgraded the Xcode. – Zoukar Nov 06 '12 at 13:40
  • The only way to solve my problem was to downgrade Xcode to the previous version. – Zoukar Nov 07 '12 at 16:37
  • that's not a good way, anyway happy to know that the issue is solved – Midhun MP Nov 07 '12 at 16:41
  • It is not a good way, but I can maintain the code until I find out what happens on Xcode 4.5.1 – Zoukar Nov 07 '12 at 16:49