如何为单个文件启用ARC [英] How to enable ARC for a single file

查看:76
本文介绍了如何为单个文件启用ARC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将使用ARC编写的单个Objective-C类引入一个旧项目.互联网为如何为您的项目启用ARC,然后为单个文件禁用ARC提供了许多参考,但是我想做相反的事情.

I want to bring a single Objective-C class written using ARC into an old project. The internet provides many references for how to enable ARC for your project and then disable it for single files but I want to do the opposite.

我想按原样保留项目,即使用手动引用计数,然后仅为新文件启用ARC. (我的搜索使我在这里失败.)

I want to leave the project as it is, i.e. using manual reference counting, and then enable ARC just for the new file. (My searches have failed me here.)

这可能吗?怎么样?

推荐答案

-fobjc-arc标志添加到要为其启用ARC的任何文件中,如

Add the -fobjc-arc flag to any files for which you'd like to enable ARC, as described in the ARC documentation.

这篇关于如何为单个文件启用ARC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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