文件不支持ARC功能,如何处理 [英] Files doesn't support the ARC feature, how to deal with
问题描述
我的项目使用ARC(自动参考计数器),所以当我尝试导入ASIHTTPRequest库时,它有4个在实现中使用自动释放语句的类,这里有一个例子:
My project uses the ARC(Automatic Reference Counter), so when i try to import the ASIHTTPRequest library which has 4 classes that used in their implementation the autorelease statement, here is an example:
[self setAccessLock:[[[NSRecursiveLock alloc] init] autorelease]];
我得到的错误:
ARC forbids explicit message send of autorelease
我该怎么办解决这个问题。
What should i do to solve this problem.
推荐答案
我有解决方案,我需要为每个文件的编译器标志添加正确的标志不支持ARC。对我来说,我使用Xcode 4.2,所以在 target - >下构建阶段 - >编译源
,双击要禁用ARC功能的文件,并将 -fno-objc-arc
点击完成
。它已完成;)
I have got the solution, i needed to add the right flags to the compiler flags for each file which doesn't support the ARC. For me, i use Xcode 4.2, so under target -> Build Phases -> Compile Sources
, double click on the file you want to disable the ARC feature and put -fno-objc-arc
the click on Done
. And it's Done ;)
请注意,如果列表中不存在该文件,您可以通过单击+按钮添加它然后执行相同的操作以上工作。
Please note, that if the file doesn't exist on the list, you can just add it by clicking the + button and then perform the same work above.
这篇关于文件不支持ARC功能,如何处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!