Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4.2 Compilation Failed with prototype cell

I'm trying out the new Xcode 4.2 Beta and I'm wondering if my code is wrong or if I'm bumping in to an bug.

The new Storyboard feature is promising but extremely buggy at the moment. Right now I've created an simple project with a tableview. This tableview will be "Grouped style" containing UITextFields. The new "Prototype Cell" feature of storyboard let's you create a prototype cell in GUI that you can draw with the "Reuse identifier" in the method cellForRowAtIndexPath. When I drag in a UITextField in this "prototype cell" and draw it out, it works great!

However! When I reference this textfield to an outlet in my code I get the error: Uncategorized Compilation failed. Unable to write to path:...(Path to DerivedData)

Why is this? Is it a bug? Anyone else get this?

like image 898
Objective Coder Avatar asked Aug 12 '11 15:08

Objective Coder


4 Answers

I've run into this problem on a couple of occasions in Xcode 4.2 (final release as well).

It's usually related to an outlet or other connection that you've set up that the compiler is upset about (for lack of a better term). The trick is determining which connection(s) that is.

You can view the detailed output of the build process in Xcode 4.2 by doing the following:

  1. Switch to the log navigator in the leftmost pane
  2. Select "Build "
  3. You should see the error(s), including your compilation failed error.
  4. You can expand the build log for that error by clicking the right most icon (looks like a list). That should expand and display the error causing the problems.
like image 117
Tony Lenzi Avatar answered Nov 02 '22 18:11

Tony Lenzi


If anyones still having a problem with this i found the solution is to use tags instead of outlets.

CellForRowAtIndexPath UILabel *titleLabel = (UILabel *)[cell viewWithTag:1001]; titleLabel.text = @"Name";

like image 42
f.perdition Avatar answered Nov 02 '22 18:11

f.perdition


OK a collegue of mine showed me the connections inspector and voila, there was an old connection causing the build failure. So select the .storyboard file, open the connections inspector (the last with the arrow) and it will give you an overview of all the connetions.

like image 4
Nutela Avatar answered Nov 02 '22 17:11

Nutela


I don't have the perfect solution to your problem but I had the same and I found a way to make it works (without linking the outlet to the TableViewController).

Just try to recreate your view from scratch and Build & Run every time you add a component.

In order add a TableViewController => Test if it shows an empty table.

Design your custom cell and link your cell's Outlets to it. (Without forgeting to change the Class of your TableViewCell) => Again test it

Then change the Class of the TableViewController to your class and now you would be able to access to your cell's outlets.

It worked for me. I hope it will for you.

like image 1
TroX Avatar answered Nov 02 '22 17:11

TroX