Set root controller with interface builder

When I drag a Navigation Controller on to the storyboard I get the Navigation Controller and a Table View Controller. I do not want the table view, so I delete it, insert a regular view controller, change its class to e.g LoginView, right-click and drag: "Relationship Root View Controller" from the Navigation Controller on to the View Controller.

Now when I run the application I get

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

I do not want to fix this programatically, since last time I did this it worked out of the box (xcode 4.2, now I upgraded to 4.3). Also, when adding the Navigation Controller in 4.2 it came with a View Controller, not a Table View Controller.

Navigation Controller has "Is Initial View Controller" set.

Answers


Try doing it the other way around.

  • Delete the navigation controller
  • Select the lasting view controller, in the menu "Editor > Embed in > Navigation Controller"
  • Check if the navigation controller has "Is Initial View Controller" selected
  • Check if in the AppDelegate there is no unnecessary code put in the applicationDidFinish method (should be empty if you didn't put a custom code in it)
  • Check if your view controller contains -(void)loadView and delete the method to avoid a black screen on startup

Hope it helps.


In Xcode 8:

  1. Right-click and drag from the Navigation Controller to the View Controller.
  2. Choose root view controller in the pop-up, under the section 'Relationship Segue'.

It's an old post, but for the ones that are still having this problem.

  • in xib you need a view controller and a window.
  • select window and go to "Connections Inspector"
  • connect rootViewController with the view controller

this should work, for me it worked.


  1. Select View Controller in Interface Builder
  2. Open Attributes Inspector
  3. Set the checkbox "Initial View Controller"

The issue is in the AppDelegate.m : - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

Try to comment out everything except for the return of course. When making an empty application this code is inserted for you and interferes with the initial view controller check that you did with in the root view controller on your storyboard. Also within your projects target, make sure the info.plist shows your storyboard as the mainstoryboard. Then finally make sure you have your initial view controller checked within the storyboard view. Select the view controller then look at its attributes. Check that little box.


My solution was to start a new project with "Single View" instead of "Empty"


Need Your Help

Computing iterations in R to calculate the rate of population increase

r population

I´ve tried to calculate the rate of population increase, denoted as r, which is obtained from:

Brackets from Beautiful Soup impacting pystache output

python beautifulsoup mustache

I am trying to insert html code, that was parsed with Beautiful Soup, into a template with pystache (mustache) and am running into some major posting issues.