问题描述
我正在使用 Xcode 4.2 并为 iphone(从 iOS 3.0 - 5.0)构建游戏.cocos2d 支持 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?
如果我对变量使用强弱关键字并将编译器设置为 LLVM GCC 4.2,结果会是什么?是否有必要将编译器更改为 3.0 以支持 ARC?
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?
推荐答案
Cocos2d v1.1和v2.0兼容ARC.但是,cocos2d 代码本身不使用 ARC,并且 cocos2d 没有提供可用于开始使用 ARC 编程的模板.您需要自己为 cocos2d 文件添加单独的静态库目标.
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.
正如 Ankit 所指出的,Tiny Tim Games 对 cocos2d-iphone 的分叉版本进行了必要的更改 使其与 ARC 兼容.这些更改已集成到开发版本中,应该在 cocos2d v2.x 分支中可用.我已经写了一个 教程在 cocos2d 中启用 ARC(2.0) 项目.
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.
据说在v2.1或者v2.2内部,cocos2d本身会被转换为使用ARC.
It was said that cocos2d itself will be converted to use ARC internally in v2.1 or v2.2.
需要注意的是,没有计划在 cocos2d v1.x 分支中正式支持 ARC,因为 v1.x 线应该保持向后兼容第一代设备和 iOS 3.x.但一般 ARC 兼容性已添加到 v1.1.
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 完全支持 ARC 并在所有 15 个模板项目中为 www.learn-cocos2d.com/2011/10/kobold2d-preview-6-giving-retain-release-autorelease-finger/">现在快两个月了.Kobold2D 使用 cocos2d-iphone 1.x 和 2.x 的最新稳定版本.只需启动一个新的 Kobold2D 项目,您就可以使用 cocos2d 和 ARC.
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.
这篇关于cocos2d 支持 ARC 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!