是否可以结合非 ARC 和 ARC 项目代码? [英] is it possible to combine non-ARC and ARC project code?

查看:16
本文介绍了是否可以结合非 ARC 和 ARC 项目代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以结合 ARC 和非 ARC 项目?我还没有真正尝试过,但情况是这样的:

Is it possible to combine ARC and non-ARC projects? I haven't really tried it yet but this is the scenario:

我们有一个带有标签控制器的旧 iOS 项目(非 ARC).选项卡控制器中有一个选项卡还没有任何功能或视图.我正在制作一个与旧项目相关的新项目,如果可以将我的新项目与旧项目结合起来并将我的新项目的视图分配给选项卡,我希望它使用 ARC.

We have an old iOS project (non-ARC) with a tab controller. There is a tab from the tab controller that doesn't have any function or view yet. I am making a new project which is related to the old project, and I would like to have it use ARC, if it is possible to combine my new project with the old one and assign my new project's view to the tab.

推荐答案

当然可以,而且非常简单.用 arc 开始你的新项目,然后用 not arc 东西标记"旧导入的 .m 文件.按照本教程了解如何操作:

Yes of course and it is very easy. Start your new project with arc and just "tag" the old imported .m files with the not arc thingy. Follow this tutorial to see how:

http://www.raywenderlich.com/5677/beginning-arc-in-ios-5-part-1

(解释了如何转换,也解释了如何以非弧形方式保持)

(explains about how to convert but also about how to maintain in a non arc fashion)

编辑:非 arc 标签是 -fno-objc-arc 你应该像这样设置你希望 xcode 考虑非 arc 的文件:

Edit: The non arc tag is -fno-objc-arc you should set the files that you want xcode to consider non arc like this:

(取自 Ray Wenderlich 教程页面)

(taken from Ray Wenderlich tutorial page)

这篇关于是否可以结合非 ARC 和 ARC 项目代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆