编译时出现ARC错误 [英] ARC error when compiling

查看:147
本文介绍了编译时出现ARC错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用LLVM GCC 4.0编译器进行编译,并且我在我的.m文件中出现了这个错误:ARC禁止显式消息发送'release'
我尝试过使用-fno- objc-arc作为编译器标志但返回错误:无法识别的命令行选项-fno-objc-arc。

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".

我该如何解决这个问题?

How can I solve this?

推荐答案

只需删除对 -release 的所有调用。您不能在ARC下调用 -release ,因为编译器将插入所有必需的 retain / 发布为您打电话。详细了解ARC 此处

Simply remove all calls to -release. You're not allowed to call -release under ARC because the compiler will insert all the necessary retain/release calls for you. Read more about ARC here.

另一种方法是使用转换工具,Xcode可以为您将项目转换为ARC(包括删除这些调用):

The other way is to use the conversion tool, and Xcode can convert your project to ARC (including removing these calls) for you:

要完全禁用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错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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