Objective-c – Xcode: Interface Builder XIB Compiler Error

cocoamacosobjective cxcode

Xcode 5.1.1 and OS X 10.9.3

I open Xcode and start a new Cocoa project. I then click run. The build fails, and I get the following error message:

Interface Builder XIB Compiler Error
Interface Builder was unable to determine the type of "MainMenu.xib".

I also don't see the usual WYSIWYG editor when I select MainMenu.xib just a black screen. I notice the "type" of file is "Default – Abstract Interface Builder File", whereas on other working projects I have built in the past, the "type" is "Default – Interface Builder File". Seems there's something about it being an "abstract" file that's causing Xcode to not display the interface builder.

I tried fully uninstalling Xcode and re-downloading it from the App Store. Didn't help. Multiple google searches have turned up nothing helpful, and the other Stack Overflow questions with a similar title to mine aren't illuminating. I can't imagine everyone else with Xcode 5.1 has this issue. Any experts out there that could suggest a quick fix?

enter image description here
enter image description here
enter image description here
enter image description here

Best Answer

Aha! What a ridiculous solution! Hope this helps somebody.

Add a new xib file!

And delete the old MainMenu.xib for good measure. The new xib will show up as expected.

enter image description here

But wait - there's more!

I'm not sure if it's just that my Xcode is horribly corrupted, but here's what else I had to do to get my application to run successfully:

1 - Go to your general project settings and set the Main Interface to your new xib file's name without the .xib extension! Otherwise, you'll get output in your console that says Unable to load nib file. See pics to compare. This will get your blank app window to pop up when you run the program.

enter image description here enter image description here

2 - Now you need your app delegate to do stuff. Drag an Object from the object library to the list of objects in the interface builder. Define its class as your app delegate class name and the object should rename itself to 'App Delegate'.

enter image description here

3 - control drag from Application to App Delegate and select 'delegate'. Now your app delegate code will work.

4 - Add a NSLog(@"app success!"); statement in the applicationDidFinishLaunching method to confirm you did everything correctly, hit run, watch the window pop up and the NSLog output into the console, and congratulate yourself for making an Apple product work the way it should have been designed to work.