Step 1: Download Cocos2d 0.8 Beta project template from here. This template works well for 0.8 beta, rc, and final version.
Step 2: Unzip the downloaded file in Step 1. Move the the folder to project templates folder. On my desktop, this folder’s location is /Developer/Platforms/iphoneos.platform/developer/library/xcode/project templates/application.
Step 3: Download Cocos2d Library from here. Untar the file, then move the folder to /Developer/Library.
Step 4: Under xcode – Preferences – Source Trees, add a source record. You can set the setting name withCOCOS2D_SRC. The path is the location of Cocos2d Library, which is /Developer/Library/cocos2d-iphone-0.8/
Step 5: Now, you can create a Cocos2d project in xcode. The Dependency and Linked Library of cocos2d andChipmunk have been added to the project by default.
Step 6: If you want to use other libraries (e.g., Box2d, etc) integrated in cocos2d, please follow the steps below.
Step 7: Add Direct Dependency. After a new project is created, right click the target and select Get Info. UnderGeneral, click the ‘+’ button of Direct Dependencies. You will see a list of target dependencies, just add the dependency you want (e.g., box2d). This step can guarantee the static library always exists (if not, the compiler will build one).
Step 8: Build the project. The dependency you added in Step 7 was built up in this step.
Step 9: Add the
Linked Static Library to the project. built up in Step 8. Right click the target and select Get Infoagain. Under General, click the ‘+’ button of Linked Libraries. In the popped-up library list, you can’t find the library built up in Step 8. You need to click “Add Other” button. Then you need to find the library yourself. The library just built up is under the folder /Developer/Library/cocos2d-iphone-0.8/build/Debug-iphonesimulator. Select the library you just built up (e.g., libbox2d.a). Now, the library has been added to the project. Click cocos2d-iphone.xcodeproj on the left side, find the target (i.e., Static Library) you want to add from the file list on the right hand side. Just simply tick the target (e.g., libbox2d.a) as shown below:
Update: In the future, if a newer version of Cocos2d is released, what you need to do is just to replace the old Cocos2d library with the new one. You don’t need to update the template. It’s very easy, isn’t it?