cocos2D IPHONE for iPhone SDK 4.0
After spending a couple mornings messing around iPhone 3.0 sdk and various incompatible libraries, I’ll like to dump some points around getting up and running with Cocos2D for iPhone.
Right now, I’m developing on iPhone 3G, and the following are very loose steps about how I got the latest version 0.9.44 of Cocos2D to compile.
1. I decided to install iPhone SDK 4.0 and XCODE 3.2.3 from the apple developer site.
2. If you recently upgraded your iPhone OS 4.0, you may need to get another provisioning profile.
After I upgraded my OS to 4.0, I got a “No Provisioned Iphone OS connected error” and here is a tech note about that issue.
3. Once I upgraded my OS and downloaded the latest version of Cocos2D, I wanted to setup XCode with Cocos2D templates.
If these templates fail to install, you may need to follow the instructions in the terminal after the error message. It failed for me and followed the advice to:
./install-templates.sh -u
BUILD
setting:
If you using an older iPhone 3G, you may need to change your Build Architecture from arm7 to arm6
http://www.cocos2d-iphone.org/forum/topic/7320
Also check the drop down Device – 4.O |Debug and make sure arm6 is checked!
You may notice that when you create a app via the template, you will encounter classes with a “.mm” file extension.
.m vs .mm
The light straight from the Objective C Primer
.m
This is the typical extension used for source files and can contain both Objective-C and C code.
.mm
A source file with this extension can contain C++ code in addition to Objective-C and C code. This extension should be used only if you actually refer to C++ classes or features from your Objective-C code.
You can mix objective-c and C++ classes although you should be careful doing so.