Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does cocos2d support ARC?

I am using Xcode 4.2 and building a game for iphone (from iOS 3.0 - 5.0). Does cocos2d support ARC? What modifications needs to be made to convert code written in previous versions?

If I use the strong and weak keywords for variables and set compiler to LLVM GCC 4.2, what will be the results? Is it a necessity to change compiler to 3.0 to support ARC?

like image 614
Vishal Avalani Avatar asked Dec 16 '11 10:12

Vishal Avalani


1 Answers

Cocos2d v1.1 and v2.0 are compatible with ARC. However, the cocos2d code itself does not use ARC and there are no templates provided by cocos2d that you can use to start programming with ARC. You are required to add a seperate static library target for the cocos2d files yourself.

As Ankit pointed out, Tiny Tim Games made the necessary changes to a forked version of cocos2d-iphone to make it ARC compatible. These changes have been integrated into the development version and should be available in the cocos2d v2.x branch. I've since written a tutorial to enable ARC in a cocos2d (2.0) project.

It was said that cocos2d itself will be converted to use ARC internally in v2.1 or v2.2.

It's important to note that there are no plans to officially support ARC in the cocos2d v1.x branch because the v1.x line is supposed to remain backwards compatible with 1st generation devices and iOS 3.x. But general ARC compatibility has been added to v1.1.


Kobold2D fully supports ARC and has it enabled in all 15 template projects for almost two months now. Kobold2D uses the latest stable versions of cocos2d-iphone 1.x and 2.x. Just start a new Kobold2D project and you're set to work with cocos2d and ARC.

like image 59
LearnCocos2D Avatar answered Sep 21 '22 05:09

LearnCocos2D