views:

256

answers:

2

I have a NIB that contains a UINavigationController which has a UIViewController. The UIViewController is being loaded externally from another nib. I am unable to set the view property thus I get the error:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "LBRootViewController" nib but the view outlet was not set.'

How can I set my view property correctly?

A: 

I think you did not assign a 'view' property for the 'File's Owner' at the Interface Builder. (if file's owner is UIViewController)

Yakov
right, but i cant wire it up in IB for some reason
Sheehan Alam
I think you can change a view when its needed. Try to assign any view in IB.
Yakov
i can assign a view, but i am loading from an external nib, so a view wont suffice in my case
Sheehan Alam
+2  A: 

You have a nib file of LBRootViewController.xib. Inside that nib is a view controller subclass that has an outlet named view. That outlet is not set.

When you (default name) MainWindow.xib loads, it instantiates an instance of LBRootViewController but then finds that the controller has no view outlet meaning it cannot display anything.

The nib you need to examine is LBRootViewController.xib and not MainWindow.xib.

If for some reason the LBRootViewController object in LBRootViewController.xib doesn't have a view property, then you have set the object to the wrong class i.e. something other than a UIViewController subclass.

TechZen