wufoo
wufoo

Reputation: 14611

Interface Builder Storyboard Compilation Failed?

New to Xcode here -- Is there a way to get more detail out of Xcode when it runs into a compile time error? The only message I get when I try to build my application is "Interface Builder Storyboard Compilation Failed". I have no idea what file it's having a problem with.

Seriously?

Nothing additional turns up under the "Build" item in the Log Navigator either.

enter image description here

Upvotes: 13

Views: 11382

Answers (4)

Mert Celik
Mert Celik

Reputation: 725

In my use case I have added a new target that runs the build script that is using xcodebuild. I was receiving the same failures but the reason was Mac Catalyst support being YES by default in Build Settings. (My main target doesn't support Mac Catalyst.) Changing those to NO in Builds Settings fixed the issue for me.

Upvotes: 0

Nitin Alabur
Nitin Alabur

Reputation: 5812

For me, it was two identical storyboards in the project that lead to this error popping up frequently.

I created a storyboard X, added a view controller Y in it. Then I refactored a view controller Z to storyboard X. Xcode asked if I want to replace the existing storyboard X and I selected Yes.

Its only after a few hrs I noticed that there are two references for the storyboard in file / project navigator (left pane). Removed one of the referneces and the issue hasn't shown up after that.

Upvotes: 0

digitalHound
digitalHound

Reputation: 4444

Thanks to wufoo I figured mine out.

I have a tableview that has five static cells. The cells have an assortment of UIImageViews, UITextFields, etc. I had created IBOutlets in the main UITableViewController .h file and connected directly to the static cells UITextfields in the storyboard. You can't do that.

Once I removed those connections it compiled fine for me.

It appears you have to connect UIWidgets (textfields, labels, imageviews, etc) in a statically created cell directly to IBOutlets in that cells .h file (NOT, as I did, to IBOutlets in the tableview .h file).

---- UPDATE ----
Ok, so my initial post was not entirely accurate. It appears you CAN connect IBOutlets from subclasses of UITableViewCell directly to the main UITableViewController .h file. You just have to make sure that you set the Table View Content field to "Static Cells". I missed that step.

Here is an image to illustrate: Screenshot Select your storyboard, in the detail pane on the left, ensure that your "Table View" is selected. In the pane on the right select your attributes inspector panel and change from "Dynamic Prototypes" to "Static Cells". Setup your static cells by dragging and dropping your components onto the storyboard, then if you want to link from your components directly to IBOutlet properties on your main ViewController .h file you can.

I discovered the issue I was having was that I set up static cells in storyboard, and then tried to recreate them again dynamically in the delegate method cellForRowAtIndexPath:. That does not work very well. If you use static cells you do not need to use any of the cell setup delegate methods.

Here is some excellent reading that also helped me out: Apple TableView Programming Guide

Upvotes: 17

wufoo
wufoo

Reputation: 14611

For what it's worth, the problem seems to be related to two IBOutlet objects declared in my .m file. One was referencing a UISlider and the other a UILabel. I removed the references and then declared them as class variables instead. In viewDidLoad I hooked them up using [self.view viewWithTag:TAG_FROM_STORYBOARD_WIDGET]. Looks like the same solution as mentioned by f.perdition in the link above.

Upvotes: 1

Related Questions