Question

Is there an easy way of getting Three20 v1.1 to work under xCode 4? I followed the steps on http://three20.info/article/2011-03-10-Xcode4-Support but that seems to be for the master. I use v1.1 as I use the TTLauncher.

The project builds fine with a normal build, and runs perfect on an iPhone. But when I want to create the archive (for the IPA for distribution) then I get 18 errors and 8 warnings.

The first one is:

../scripts/Protect.command: line 23: cd: /Users/XXX/Library/Developer/Xcode/DerivedData/iDoms-cmyivarwxpbvqdfnyclqdrikrtmw/ArchiveIntermediates/iDoms/BuildProductsPath/Release-iphoneos/../three20/Three20UICommon: No such file or directory

Most others are 'no such file or directory' on e.g.: #import "Three20Core/TTGlobalCoreLocale.h"

or 'undeclared (first use of function)' which comes from the 'no such file or directory issue I presume'.

In my 'Header search paths' I have:

$(BUILT_PRODUCTS_DIR)/../three20
$(BUILT_PRODUCTS_DIR)/../../three20
../../three20/Build/Products/three20
/usr/include/libxml2

Any help would be very appreciated!

Was it helpful?

Solution

You should check out this StackOverflow question.

I've reproduced the accepted answer below:

So it looks like the easiest way to get old Xcode 3.2 projects to work with Xcode 4 is to do the following:

Go into Xcode 4's preferences (Cmd+,). Select the "Locations" tab. Where it says "Build Locations", select the drop down and pick "Place build products in locations specified by targets" I'll write up a three20.info article going into more details about this.

OTHER TIPS

Just to add to Colin's answer: you can use Xcode's dependent projects feature to use three20, even though the three20 website says it's not "officially supported":

  1. In your workspace, right-click on the empty space in your project navigator. Select "Add files to "My Workspace", and select the three20 project (three20/src/Three20/Three20.xcodeproj). This is the only project you need to add: it is not necessary to manually add the three20 subprojects.

  2. Select your project in the navigator, go to Build Phases, open "Link binary with libraries", click on the "+" in the bottom left corner, and add the Three20 libraries: libThree20.a, libThree20Core.a, libThree20Network.a, libThree20Style.a, libThree20UI.a, libThree20UICommon.a and libThree20Navigator.a. This will cause Xcode to build Three20 when you build your project.

  3. Add ${BUILD_DIR}/three20 to your include path as per Colin's answer: go to build settings, double click on "Header Search Paths", and add ${BUILD_DIR}/three20 (it will show as build/three20 when you close the dialog).

  4. Add three20/src/Three20.bundle to your resources.

  5. It's probably also a good idea to add the linker flags -ObjC and -all_load if you haven't already done so (same dialog, setting "Other Linker Flags").

The steps above are good enough for compiling the code. To make "Archive" work too, you will need to:

  1. Add $(BUILT_PRODUCTS_DIR)/../three20 and $(BUILT_PRODUCTS_DIR)/../../three20 to the Header Search Paths setting. If you don't you will get compilation errors that the three20 headers cannot be found.

  2. For all Three20 projects (so not just the top-level project), go the Build Settings and set "Skip Install" to YES. If you don't, the project will build, but you will not be able to create an IPA.

Make sure that your product name (select your target, go to Build Settings, then setting "Product Name") does not contain spaces, otherwise archiving will not work.

Finally, if you're getting errors such as ld: library not found for -lThree20 and you are using a custom build configuration (such as AdHoc), make sure to add the same build configuration to each of the Three20 projects too (just duplicate the Release configuration).

Add these two paths to your header search paths in the build settings for your target:

"$(BUILD_DIR)/three20" "$(BUILD_DIR)/../three20"

The first entry is needed for regular builds and the second entry is needed for archives.

It's that easy.


Incidentally, to create a file in your home directory with a list of all of Xcode's environment variables for your target's environement, add the following Run script build phase to your target with contents: ENV > ~/xcode-environment.sh

Note that in this case, if your project is not making it through the compile phase of the build process, and your Run script comes later, the script won't get executed, so put it first.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top