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

前端 未结 6 1266
轻奢々
轻奢々 2021-01-15 04:44

Getting the above error when my app launches. The following code is from my AppDelegate .h File

#import 

@interface TableViewAppDelegat         


        
相关标签:
6条回答
  • 2021-01-15 05:10

    Select your target project.Then set your mainstoryboard name from the dropdownlist in summary section.

    0 讨论(0)
  • 2021-01-15 05:21

    Maybe it does sound stupid, but I got this error because I linked the root view controller with one button's event. This issue was gone when I removed this connection.

    0 讨论(0)
  • 2021-01-15 05:22

    One of the ways, I overcame this was by the following steps:

    1) Start Xcode and choose Empty Application

    2) Now Goto the File --> New Application under UI

    3) Give it a name --> myView

    4) Now create a custom Class --> myView

    5) Goto the .xib file now and click on the File Owner and under the Class Attribute enter --> myView as the custom Class

    6) Now add a button and create an action

    7) It should work

    0 讨论(0)
  • 2021-01-15 05:23

    add this in your app delegate:

    self.window.rootViewController = navigationController;
    
    0 讨论(0)
  • 2021-01-15 05:26

    Swift 2 solution that worked for me :

    Insert the code below in AppDelegate -> didFinishLaunchingWithOptions

    self.window!.rootViewController = storyboard.instantiateViewControllerWithIdentifier("YourRootViewController") as? YourRootViewControllerClass

    0 讨论(0)
  • 2021-01-15 05:29

    If you started with an empty template and added a storyboard, you need to do a couple of things:

    • In project settings ->General, select your storyboard as the main interface

    • You also need to delete the following lines from YourAppDelegate.m

      self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
      // Override point for customization after application launch.
      self.window.backgroundColor = [UIColor whiteColor];
      [self.window makeKeyAndVisible];

    0 讨论(0)
提交回复
热议问题