Nic Hubbard
Nic Hubbard

Reputation: 42165

iOS6: UIViewController was unable to load nib named

When testing in the iOS6 simulator, I am getting the following error when clicking a disclosure indicator:

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

It runs perfectly fine in iOS5.

I do NOT have the LocationDetail nib anymore, nor need to use it. I have looked in my entire project for references to it, as well as in my MainWindow nib and all connections looking to see where it could be used, but I find none.

How would XCode still be wanting to load this, and why only the errors in iOS6?

Upvotes: 1

Views: 2051

Answers (3)

jaredsinclair
jaredsinclair

Reputation: 12687

The problem is not in Xcode, but in the iOS Simulator. If you've removed all references to the .xib in your project, and cleaned everything as you described, the problem is that the .xib file still exists in the app bundle in the Simulator. You should try deleting the app from the Simulator (or better yet, Reset All Content & Settings on the Simulator). This will fix it.

Upvotes: 3

hsn
hsn

Reputation: 173

what i know is that initWithStyle:UITableViewStyleGrouped will call the initWithNibName:Bundle: method...

your class had the same name as your nib file, so when you called the initWithStyle:UITableViewStyleGrouped it tried to load that nib file.

when you renamed your class, it didn't find an nib with the same class name so no errors showed up as before.

Upvotes: 1

Nic Hubbard
Nic Hubbard

Reputation: 42165

I decided to just rename my class and .h and .m files and that fixed the issue.

Who knows why.

Upvotes: 0

Related Questions