And that title describes exactly what I’m doing for the next hour. Updating old projects is really the tricky part, but I’ve found a near-perfect article that already describes that process (with pictures…full COLOR too)
First thing, go ahead and update XCode to 4.2. Hopefully that goes well for ya. Went fine for me. Now for Cocos2D, you’ll want to get the latest version at http://www.cocos2d-iphone.org/ After downloading I put the folder on my desktop, then opened Terminal to get the templates reinstalled. So in the terminal, that magic line to do so looked like…
sudo /Users/justin/Desktop/cocos2d-iphone-1.1-beta/install-templates.sh -f
In your case, justin would be your computer’s user name. Another easy way of getting Terminal to point to that install-templates.sh file is to just type the word sudo in Terminal, then drag in that install-templates.sh file (found in the folder of Cocos2D stuff) and Terminal will fill in the location, giving you something like the full line I pasted above. Next up, just type in -f at the end, so you can overwrite any existing Cocos2D files.
Now if you’re like me and need to update some previous projects, you can. IF you want to. They might still run just fine. Mine had some issues when I opened them in XCode 4.2, so I figured updating Cocos2D was the first safest thing to do. So again, here’s that same article by Steffen Itterheim that lays out everything for ya.
After adjusting some deprecated code, the only issue I was left with had to do with Box2D. I was getting this error…
“Variable length of array of non-POD element type b2Vec2”
And even though I had upgraded Box2D, I had to also overwrite these two files GLES-Render.h and GLES-Render.mm which were also in that downloaded folder of Cocos2D stuff. I just had to search for them and replace my existing ones (actually I just copied and pasted the code)