Thanks
Thanks

Reputation: 40339

How to fix iPhone Simulator trying to launch a Nib that isn't there?

I'm getting this error message when I Build&Go:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] was unable to load a nib named "TestappViewController"'

I created a blank new project and then started to create a RootViewController which holds two other UIViewController's. XCode automatically created the TestappViewController, and I deleted it to start totally from scratch. MainWindow.xib shows me no TestappViewController in IB, but inside the XML structure of MainWindow.xib I find this:

<object class="IBUIViewController" id="943309135">
<string key="IBUINibName">TestappViewController</string>
<object class="IBUISimulatedStatusBarMetrics"
key="IBUISimulatedStatusBarMetrics"/> </object>

I checked all my XIB's for a reference to an TestappViewController, but there's nothing. Testapp-Info.plist points to MainWindow.xib only.

Tried to delete this part out of the XML from MainWindow.xib, but this gives some weird Xcode errors, so I re-inserted it. I assume the bug in the XIB files, but don't find anything.

Any idea at which point I could fix that?

Upvotes: 0

Views: 5150

Answers (6)

flagg19
flagg19

Reputation: 1782

Go to: Application Support -> iPhone Simulator -> *your_simulator_version* Delete the folder related to your app, clean solution, run the app.

It worked for me... the problematic xib was still in that folder after i removed it from the project and for some reason, the app tried to load it even if there was absolutely no ref in xcode.

Upvotes: 0

Hagan
Hagan

Reputation: 11

I had this problem, none of the above solutions worked. For me, I had to right click the xib file in the Resources folder > get info and in the Targets tab make sure the target box for my app was checked.

Upvotes: 1

Armin
Armin

Reputation: 31

Go to iPhone Simulator, then click on "Reset content and settings". That did the job for me.

Upvotes: 3

Brad The App Guy
Brad The App Guy

Reputation: 16275

Most likely, the file's owner of the View Controller object in the MainWindow.xib was set to TestappViewController, instead of UIView controller. What you could have done is change it back to UIViewController in the Identity Inspector (4th TAb)

Upvotes: 0

Thanks
Thanks

Reputation: 40339

Finally I figured out that I had to delete and recreate the View Controller object in the MainWindow.xib. Previously I just edited the existing View Controller object and directed it to another class, which doesn't seem to work properly. Now all is fine :)

Upvotes: 3

ennuikiller
ennuikiller

Reputation: 46965

In iB in the connections inspector for the mainwindow make sure the connection to the TestappviewViewController is deleted

Upvotes: 1

Related Questions