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

試著忘記壹切 提交于 2019-12-03 22:59:35

问题


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.


回答1:


Go to AppDelegate class and add:

self.window.rootViewController = self.viewController;


来源:https://stackoverflow.com/questions/13232209/xcode-4-5-1-application-windows-are-expected-to-have-a-root-view-controller-at

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