简体   繁体   English

编译时出现ARC错误

[英]ARC error when compiling

I'm trying to compile using the LLVM GCC 4.0 compiler, and I get this error in multiple of my .m files: ARC forbids explicit message send of 'release' I've tried using -fno-objc-arc as a compiler flag but that returns the error: Unrecognized command line option "-fno-objc-arc". 我正在尝试使用LLVM GCC 4.0编译器进行编译,并且在我的.m文件的多个中出现此错误:ARC禁止显式消息发送'release'我尝试使用-fno-objc-arc作为编译器标志但是返回错误:无法识别的命令行选项“-fno-objc-arc”。

How can I solve this? 我怎么解决这个问题?

Simply remove all calls to -release . 只需删除所有对-release调用。 You're not allowed to call -release under ARC because the compiler will insert all the necessary retain / release calls for you. 您不能在ARC下调用-release ,因为编译器会为您插入所有必要的retain / release调用。 Read more about ARC here . 在这里阅读有关ARC的更多信

The other way is to use the conversion tool, and Xcode can convert your project to ARC (including removing these calls) for you: 另一种方法是使用转换工具,Xcode可以为您将项目转换为ARC(包括删除这些调用):

To disable ARC entirely, change your build settings: 要完全禁用ARC,请更改构建设置:

However I'd recommend you start using ARC, it will make things a lot easier and actually faster too. 但是我建议你开始使用ARC,它会让事情变得更容易,实际上也更快。

如果您正在使用ASI( http://allseeing-i.com/ASIHTTPRequest/How-to-use )api,请参阅此答案,因为它需要使用特定类的-fno-obj-arc标志构建... 文件不支持ARC功能,如何处理和引用标题为“为这一类禁用ARC”的答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM