Tutorial: cocos2d Xcode Project: Get the latest version of cocos2d-iphone
Search my cocos2d for iPhone FAQs & Tutorials
Please note that the blog search in the upper right corner doesn’t search my FAQs and Tutorials.- Note: please do not share direct download links to PDF files, the download links expire after a couple minutes!
As a reminder, here's how to update cocos2d to the latest version.
Get the latest version of cocos2d-iphone
To update the cocos2d-iphone source code to the latest version, change to the directory where you initially downloaded cocos2d-iphone and enter in Terminal.app:
git pull http://github.com/cocos2d/cocos2d-iphone.git
It's the same command you used to initially download the source code.
Warning: updating cocos2d-iphone may break your code in unexpected ways!
Just a heads up: when you pull a new cocos2d-iphone version from the git repository there's always a chance that changes made to the engine will break your code. Actually, that is very likely to happen. There may be functions removed, parameters added, variables renamed and plenty of other things changed that may cause your code not to compile. Even if your code compiles the changes to the cocos2d engine may introduce strange bugs and weird behavior. First and foremost it is your responsibility to fix these issues, unless of course there's really a bug in the cocos2d engine itself, which can also happen. This extra work is something you have to come to terms with if you want to develop at the bleeding edge of iPhone game development.
The best strategy for you to remain a happy cocos2d-iphone programmer may seem counter-intuitive at first: pull new cocos2d-iphone updates frequently, as often as daily and before you start working on your code. Even if you don't need a specific bugfix or feature. That way, whatever may break it will most likely be very easy to identify and fix. But if you wait weeks or months before doing a cocos2d-iphone engine update, you may actually be better off not doing it at all and instead just use the cocos2d Project Templates and stick to the cocos2d-iphone version you start your project with. Just know that you'll hardly be able to benefit from the latest cocos2d engine bugfixes and features - it's the price you pay for taking the easy route at the start of a project.
There's one exception to the "update cocos2d daily" rule though: if you get close to releasing your game to the App Store, or completing the latest patch for your game, you should not pull the latest cocos2d-iphone version for a while. Especially not at the very last minute. Chances are that something might break that you'll miss but your users will find out about and give you bad reviews because of it. So while you're stabilizing your own build, one of the rules to ensure that your code remains free of bugs and weird side-effects is not to update the underlying game engine, or any code that you haven't written yourself for that matter. Even if the change to the engine may seem trivial - you never know! So wait until after the App or patch is released before you perform another engine update. And by "released" i mean released, not just submitted to Apple for review. You need to be able to quickly submit another build in case of a rejection by Apple.
Comments (1)
Related Questions
- What are the advantages to Cocos2d from other game engines? - 2 weeks ago
- What is Cocos2d? - 2 weeks ago
148 Responses to “Tutorial: cocos2d Xcode Project: Get the latest version of cocos2d-iphone”
-
Hey,
is there a guide to integrating the SpaceManager to a normal cocos2d project (one not using your template)? I am trying to do the same and am getting close to 3500 errors. many of them have been listed in the discussions here like ‘stary @ in program’ , but they havent worked for me
Thanks
Shamik-
when I used SpaceManager0.0.4 it worked just fine, but with 0.0.5 I get those strange and alarmingly large number of errors, what could be the problem?
-
-
What’s the best way to branch a project’s cocos-2d?
So for example I have my cocos2d folder which I update regularly and which the project is linked to (via method in this tutorial). At some point I decide I no longer want to have the linked version of cocos2d update for this particular project. What’s the best way to go about branching that so the project’s cocos2d no longer update’s when I do that pull.
If it’s just copy/rename folder and then reconnect, what’s the list of things I have change in the project?
Thanks for all your help!
-
I have been following this very thorough… but still I am getting build errors.. CClabel not defined…
What is missing? Which step did I overlook?
Help would be appreciated!
Thanks! -
I got it to work, when I added the folder “libs” from the dummy project (temporary cocos2d project described in your tutorial), but this step is not listed, that this folder also needs to be copied… or did I miss something again?
-
Really helpful. Especially configuring project for Add-hoc & App Store deployment.
-
After completing the “Getting our project to build minimal cocos2d code” I get the following when build and run:
Undefined symbols:
“_OBJC_CLASS_$_RootViewController”, referenced from:
objc-class-ref-to-RootViewController in cocos2dTemplateProjectAppDelegate.o
ld: symbol(s) not found
collect2: ld returned 1 exit status -
The latest pulled by git… v0.99.5
Thanks for the link, I’ll go and try it…
-
It worked, thanks!
-
i’m having the same problem - what exactly did you do to resolve it?
-
fixed - the new (0.99.5) cocos2d-template adds the following files:
RootViewController.h
RootViewController.m
GameConfig.hi just copied them, and the build worked again.
-
-
-
-
[...] weeks I have been getting approximately 75,000 errors in my project using Cocos2d. I then found this article, and set my project up that way. Works fine [...]
-
Any recommendations where the ‘cocos2d-iphone folder’ should go..?
I assume it can go anywhere… but would be interested to hear where people put it.Is the Developer folder a sensible place? or should it go in my home folder somewhere?
-
Where do you get this file, cocos2d Application.zip ?
-
Thanks mate, great setup, got it working for the Device.
With 4.1 there are issues building for the simulator:
To get it building on the simulator do the following:
1. Right click on the Targets -> cocos2DXrefTest
2. Click Get Info from the displayed options.
3. Click “Base SDK”
4. Select iOS Simulator 4.0 from the options.
5. Build and Harry’s your Uncle!Regards,
Peter -
Hi Steffen.
After last update of cocos2d my project is not compiled.
Please take a look on this thread http://www.cocos2d-iphone.org/forum/topic/11150Hope you can help me.
Thanks. -
hi Steffen,
managed to compile and run you template just downloaded from git hub after changing cocos2d-project “base sdk” to “iOS Simulator 4.1″ and “Architectures” set to “optimized” . this is under xcode 4 preview. Oh and compiler set to GCC 4.2 instead of LLVM 2.0
Although the projects builds and runs with no errors i am getting 2099 issues under box2d. How come? am i doing something wrong or this is normal???
why xcode 4 and not 3? since i am new to xcode I dont want to learn 3 and by then have to learn ver. 4. i know i cant submit with xcode 4 yet but until my game is done xcode 4 will probably be released!
-
Thanks for the tutorial Steffen.
I think a few steps are needed to make this work correctly given the changes you suggest making to the AppDelegate code and differences between class naming of the view controller in OpenGLES projects vs. Cocos2D projects. When you create an OpenGLES project, the ViewController class takes on the name of the project…so, “myproject” would contain myprojectViewController.h/.m, while the cocos2D project creates “RootViewController”
If you copy the appDelegate code from the cocos2D project and paste over the OpenGLES project’s appDelegate code, the app delegate will now be referencing “RootViewController”. You will need to refactor the appDelegate so that the class is actually RootViewController and will compile successfully.
-
Hey, I have a problem with the loading of the cocos2D template. It does not load from the folder where I download it. There is no cocos2D project template when I want to create a new project.
Can you help me?
May 14, 2010 21:33
update cocos2d daily close to release -> its git, just make a branch