5
votes

I created a simple tab bar application in Xcode.

The default tab bar has 2 tab bar items. I add a third tab bar item and set its view controller attribute to a view i had created and subsequently saved called ThirdView.xib.

When I try to run, the first two default tabs work fine. The third one I added throws this error:

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

I apologize as I'm a huge iPhone-SDK n00b, but no manner of clicking and dragging and control-click dragging is allowing me to set the view outlet on the third view I had created.

3

3 Answers

2
votes

I had similar problem 10 mins ago, it was unsaved xib file :). For some reasons XCode doesn't ask to save xib files when one hit run.

But if that isn't the case, I would double check if the view is indeed connected in the xib file.

To do so open ThirdView.xib as plain text file (right click > open as > plain text file) and search for text: ">view<". If the view is connected you should find something similar to the code below:

<object class="IBConnectionRecord">
    <object class="IBCocoaTouchOutletConnection" key="connection">
        <string key="label">view</string>
        <reference key="source" ref="372490531"/>
        <reference key="destination" ref="191373211"/>
    </object>
    <int key="connectionID">15</int>
</object>

If you can't find it this could mean that the problem is caused by a bug in Interface Builder. Then you can try to add the connection by hand. Let me know if that is the case.

1
votes

Check the filename you're passing to initFromNib (or however you're loading the controller). A typo or including the extension can result in this message.

0
votes

Using XCode 4, I got this error because I did not set the NIB name for the "Third" button on the Tab Bar Controller. I fixed it by selecting the "Third" button, not the tab bar item within the button, and using the Attributes Inspector I set the NIB name.