Three20 & Xcode4: Solving the Various Build and Archive Errors

After struggling for hours to solve the various build errors with Xcode4 and Three20 (old Xcode3.2 project), and then investing additional precious time to get the Xcode4 “Archive” option to work, I decided to document my steps to who ever find it useful.

I’m aware that there are useful guides about this topic, but unfortunately I could not find a complete article that answer all the various build option errors. So hopefully this will be it… :)

First thing to notice is that there is a difference between the “Archive” option and the different “Build for X” options (e.g. for running, archiving, testing).

First thing first. Let’s get the “Build for X” option to work:

  1. Open your project in Xcode4 and in the “Project Navigator” view, do the following for each “Three20″ related project (e.g. Three20, Three20Core, etc):
    - Click on the project.
    - Select the “Build Settings” tab.
    - Search for “Skip Install” setting and make sure it is set to YES for Debug, Internal and Release configuration.
    - Click on the project’s target (under the TARGETS section).  Make sure it is NOT the UnitTests target but rather the actual build target – and set the same YES value in the “Skip Install” setting.

    Make sure to repeat these steps in each Three20 project in your project tree.

  2. In the “Project Navigator” view, select your project and then “Build Settings”. In the “header search paths” setting add the two following entries (with the quotes) and make it the first entries in the list:”$(BUILT_PRODUCTS_DIR)/../three20″
    “$(BUILT_PRODUCTS_DIR)/../../three20″

    Make sure to set it both in release and debug configuration, and that the same build setting appear in your poject’s target (under the TARGETS section).

  3. Follow this link to edit the Three20 scripts to enable support for Xcode4: http://stackoverflow.com/questions/5261447/xcode-4-three20-create-ipa-archive-no-such-file-or-directory/5270483#5270483
  4. Go to Xcode4 Preferences (Cmd + ,) > Locations > Build Location > and select “Place build products in derived data location”.
  5. Build your project. This should work fine both for release AND debug configurations! If there are still build errors, see the troubleshooting section below.

Now comes the part where we make the “Archive” function to work:

  1. Make sure you performed the steps above and everything compiles OK.
  2. Go to Xcode4 Preferences (Cmd + ,) > Locations > Build Location > and select “Place build products in locations specified by targets”
  3. Select the Archive option – it should build OK now.

As you can notice, from now on the only thing you need to manually change before switching between “Archive” and “Build fo *” option is the “Build Location” setting in Xcode4 preference window.

Troubleshooting

  1. If you still getting build errors try the “Clean” action under the “Product” menu and build the project again.
  2. If you get the “File not found” error, make sure your import is “Three20/Three20.h” and not a direct import to a class header  (e.g. “Three20/TTImageView.h”)

24 Responses to “ “Three20 & Xcode4: Solving the Various Build and Archive Errors”

  1. Brian says:

    As someone who has been struggling for an hour or two trying to get the Archive function to work, your tip just saved me from going insane. Thanks for posting this.

  2. Stefan says:

    Thank you for posting this step by step guide, I too was going insane trying to figure out how to build the archive.

    As a tip for anyone reading this:
    Be careful when copying the header search paths and replace the quotes or delete them all together. The characters used here for the quotes break the paths and you will get the “File not found” error.

  3. David says:

    Thank you, Amir. I doubt I could have figured this out on my own.

    Much appreciated!

  4. AMM says:

    Thank you so much. Saved me lots of time and frustration.

  5. Tuyen Nguyen says:

    Thank you soooooooo much for your post.
    It saved me a lot of time and frustrations.

    God bless you!!!

  6. Joshua Lay says:

    Thanks for this article Amir!

    Really helped me get a contractors code up and running.

  7. vsm says:

    I can’t thank you enough for publishing this step-by-step!

  8. nvr says:

    I couldn’t find Xcode Preferences (Cmd + ,) > Locations > Build Location > “Place build products in locations specified by targets” in Xcode4.3.1.

  9. Paresh says:

    I did this everything and the error count reduced to 3 from 11! The following errors not sure how to get rid of them!

    ‘Three20Core/TTDebug.h’ file not found
    ‘Three20Core/TTCorePreprocessorMacros.h’ file not found
    ‘Three20Core/TTGlobalCore.h’ file not found

    Could you help please.

    • Amir says:

      make sure you include “Three20.h” in your code instead the specific header file, e.g. “TTDebug”

      • Vijay says:

        I still get error for files included in the framework of Three20 itself. Same errors as pointed earlier by Paresh

  10. Luke says:

    This worked perfectly! Can’t thank you enough.

  11. Thomas says:

    I don’t know what the qualifications for getting a noble peace prize are these days, but if it were up to me, you’d get one for doing this.

  12. Shanif says:

    You are awesome. Thanks for this… just closed out a whole day of Three20 headaches with a quick and simple fix from you

  13. paul_1991 says:

    Thank you so much! it works! ..

  14. Vikas ahuja says:

    Thanks.., this is really awesome.. helps me allot.

  15. abi says:

    Thank you so much. Its really very useful information.

  16. Deena says:

    Heya! I’m at work surfing around your blog from my new iphone! Just wanted to say I love reading your blog and look forward to all your posts! Keep up the great work!

  17. This is my first time pay a visit at here and i am truly impressed to read everthing
    at single place.

  18. Hurrah, that’s what I was seeking for, what a stuff! existing here at this blog, thanks admin of this site.

  19. coupons says:

    Thanks for finally talking about > Three20 & Xcode4: Solving the Various Build and Archive
    Errors | My Sandbox < Loved it!

  20. Have you ever thought about publishing an ebook or guest authoring
    on other blogs? I have a blog based upon on the same information you discuss and would love
    to have you share some stories/information. I know my audience would enjoy your
    work. If you are even remotely interested, feel free to send me an
    e mail.

  21. ??????? says:

    时代。1、 黄季?约占总投资额度的50%,在手艺工艺长进行攻关,自动化台湾机械0关税进口注意事项系统、产品与技术可谓深切个中,面临着愈来&#248

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>