Date: March 10, 2011

Xcode 4 Transition Guide

Apple is aiming for Xcode 4 to be the primary iOS development environment and, as a result, many will need to transition from Xcode 3.2 to Xcode 4. This guide has been put together in order to help you migrate your apps to Xcode 4 successfully.

What you need to do

For existing projects

If you want to start using Xcode 4 with an existing project made using Xcode 3.2.#, all you need to do to update your project is run ttmodule again like so:

> python three20/src/scripts/ttmodule.py -p path/to/your/project/project.xcodeproj Three20 --xcode-version=4

This will add the following two header search paths to your project:

"$(BUILT_PRODUCTS_DIR)/../three20"
"$(BUILT_PRODUCTS_DIR)/../../three20"

If you do not want to use ttmodule to do this, you can do it by hand. Simply modify your target's settings and add both values to the "Header Search Paths" value. Please ensure that you've added the quotes around the paths. This is in case there are any spaces in your path. Without the quotes, Xcode will see the space and think you're passing two paths instead of one.

We specify both flags before the existing search path because we want to prioritize these folders over the other one.

For new projects

Please use the ttmodule script to add Three20 to your project. We do not currently directly support workspaces.

The Dirty Details

Build output is now, by default, placed in a "derived data location". This goes against a basic assumption the Three20 ecosystem makes about the build environment: that it controls where its build output goes. As a result, when you open an Xcode 3.2.# project in Xcode 4, it will build your Three20 dependencies in a new "derived data location". When your app then goes to look for the Three20 headers in ../three20/Build/Products/three20, it won't find the files. If it does, it's only because you probably still have files leftover from being built by Xcode 3.2.#.

We solved this problem by adding some harmless additional search paths and doing conditional checks of the Xcode version and build type where necessary.

blog comments powered by Disqus