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

查看:99
本文介绍了是否可以组合非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启动您的新项目,并使用非arc thing标记旧的导入的.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)

编辑:非弧标记是 -fno-objc-arc 你应该设置你希望xcode考虑非弧形的文件,如下所示:

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天全站免登陆