cocos2d支持ARC吗?
我正在使用 Xcode 4.2 并为 iphone 构建游戏(从 iOS 3.0 - 5.0)。 cocos2d支持ARC吗?需要进行哪些修改才能转换以前版本编写的代码?
如果我对变量使用 Strong 和 Weak 关键字并将编译器设置为 LLVM GCC 4.2,结果会怎样?是否需要将编译器更改为3.0才能支持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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Cocos2d v1.1 和 v2.0 兼容 ARC。但是,cocos2d 代码本身不使用 ARC,并且 cocos2d 没有提供可用于开始使用 ARC 编程的模板。您需要自己为 cocos2d 文件添加单独的静态库目标。
正如 Ankit 指出的那样,Tiny Tim Games 对 cocos2d-iphone 的分叉版本进行了必要的更改 使其兼容 ARC。这些更改已集成到开发版本中,并且应该可以在 cocos2d v2.x 分支中使用。我写了一个 在 cocos2d 中启用 ARC 的教程(2.0)项目。
据说cocos2d本身将在v2.1或v2.2中转换为在内部使用ARC。
需要注意的是,cocos2d v1.x 分支没有正式支持 ARC 的计划,因为 v1.x 系列应该保持与第一代设备和 iOS 3.x 的向后兼容。但一般的 ARC 兼容性已添加到 v1.1 中。
Kobold2D 完全支持 ARC,并在 现在快两个月了。 Kobold2D使用cocos2d-iphone 1.x和2.x的最新稳定版本。只需启动一个新的 Kobold2D 项目,您就可以使用 cocos2d 和 ARC 了。
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.
尽管Cocos2d不支持arc,但是有一种方法可以将它们一起使用,那就是跨项目引用。你可以参考这个来了解如何做到这一点。 cocos2d 和 ARC< /a>
Even though Cocos2d does not support arc but there is way in which you can use both of them together, and that is by cross project referencing. You can learn how to do it by refering this.. cocos2d and ARC
更简单的是,只需在这里获取我的 cocos2d-ARC 模板: https://github.com/Elland /Cocos2d-iphone-ARC-template 没有麻烦,只需将项目重命名为您想要的名称即可:)
Even easier, just get my cocos2d-ARC template here: https://github.com/Elland/Cocos2d-iphone-ARC-template hassle free, just rename the project to your desired name and you're set :)