Xcode 4.2 Compilation Failed with prototype cell

前端 未结 7 1924
陌清茗
陌清茗 2021-02-06 05:54

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 bug

相关标签:
7条回答
  • 2021-02-06 06:00

    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.
    0 讨论(0)
  • I had to remove the folder for my project in ~/Library/Developer/Xcode/DerivedData/ and rebuild. You can find the name of that folder in the logs using Tony's procedure above.

    EDIT: I now think this is a bug in Xcode (Version 4.2.1). It's intermittent for me. To fix it I have to rebuild, sometimes two or three times. Build/Clean doesn't seem to help.

    EDIT 2: Ok, hopefully the real problem. I had two references to my storyboard in the project navigator (probably a remnant of copying/rebuilding the project). I just removed one of them (making sure to only delete the reference!). Seems likely to be the problem (Xcode compiling the same file twice simultaneously).

    0 讨论(0)
  • 2021-02-06 06:07

    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.

    0 讨论(0)
  • 2021-02-06 06:09

    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.

    0 讨论(0)
  • 2021-02-06 06:18

    You should not add the title or the image or detail label to an outlet.

    Why do you need an outlet anyways ?

    They get modified implicitly inside the code when you implement the protocols.

    0 讨论(0)
  • 2021-02-06 06:20

    I got this error when I tried to put a / in the name of a storyboard ID. Check that you are using safe characters! (Doh!)

    0 讨论(0)
提交回复
热议问题