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

后端 未结 30 2132
野的像风
野的像风 2020-11-22 06:42

I get the following error in my console:

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

30条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-22 07:20

    I got this when starting with the "Empty Application" template and then manually adding a XIB. I solved it by setting the main Nib name as suggested by Sunny. The missing step in this scenario is removing

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

    from

    application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    

    As it will overwrite the instance of your window created in the Xib file. This is assuming you have created a ViewController and wired it up with your window and App Delegate in the XIB file as well.

提交回复
热议问题