`
stephen830
  • 浏览: 2967759 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

ARC forbids explicit message send of release-关闭xCode项目的ARC

 
阅读更多

 

ARC forbids explicit message send of release-关闭xCode项目的ARC

 ARC forbids explicit message send of 'release'
'release' is unavailable: not available in automatic reference counting mode
今天,遇到了这么样的问题。


 


很显然,是ARC的问题。
错误原因:因为我们设置了用ARC来管理内存释放,我们却又调用了release方法去释放对象。

ARC是什么?(我也贴一段网上的简短说明)

ARC是iOS 5推出的新功能,全称叫 ARC(Automatic Reference Counting)。简单地说,就是代码中自动加入了retain/release,原先需要手动添加的用来处理内存管理的引用计数的代码可以自动地由编译器完成了。该机制在 iOS 5/ Mac OS X 10.7 开始导入,利用 Xcode4.2 可以使用该机制。简单地理解ARC,就是通过指定的语法,让编译器(LLVM 3.0)在编译代码时,自动生成实例的引用计数管理部分代码。有一点,ARC并不是GC,它只是一种代码静态分析(Static Analyzer)工具。

解决方法:
看图说话吧:


 
搞定!

还有一种情况:
当引入外部或者第三方库的时候,有的需要ARC支持,有的却不需要甚至不允许。遇到这种,情况该如何设置?

分别设置ARC选项

分别解决呗。
看图说话:


需要使用ARC支持的输入 -fobjc-arc
不使用ARC机制,只需要输入 -fno-objc-arc


 
搞定!

 

 

  • 大小: 199.5 KB
  • 大小: 223.7 KB
  • 大小: 196.7 KB
分享到:
评论

相关推荐

    C++学习与应用 程序设计

    好好看看,很But what, to serve our private ends, Forbids the cheating of our friends? Charles Churchill Instead of this absurd division into sexes they ought to class people as static and dynamic. ...

    串口调试程序

    串口调试程序

    java实现算法

    java实现各种算法,与大家分享

    pja_2.5.zip

    It is also impossible to compute off-screen images when the Java security manager forbids access to any Toolkit or the AWT library. In that case you can although create an instance of ...

    matlab视网膜图像分割代码-Chap_1:第1章

    forbids > 25MB file)发布进行评估,注意训练新模型会删除相应的文件夹) 其他基线代码 计算环境 112GB 内存 Ubuntu 14.04 依赖关系 数据集 杜克大学 Sina Farsiu 教授团队慷慨解囊 结果 用法 训练模型 >> run(main...

Global site tag (gtag.js) - Google Analytics