OC中ARC forbids explicit message send of '...'错误

转自CSDN hahahacff
有所整理

ARC forbids explicit message send of'retainCount'

  • 同'release'等等


很显然,是ARC的问题。
错误原因:在创建工程的时候点选了“Use Automatic Reference Counting”选项,但是又调用了对象的retainCount方法

ARC是什么?

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

解决方法

  1. 选择要项目,双击中间的工程名称,进入build setting
  2. 将中间的Objective-C Automatic Reference Counting改为no

Object-C中ARC forbids explicit message send of ' ' 错误的更多相关文章

  1. OC中ARC forbids explicit message send of release错误(转)

    ARC forbids explicit message send of'release' 很显然,是ARC的问题. 错误原因:在创建工程的时候点选了“Use Automatic Reference ...

  2. OC中ARC forbids explicit message send of release错误

    在ios编程中,如果成员变量为对象,我们需要对成员变量内存管理,否则,会造成内存泄露.即我们要对成员变量进行手动的内存释放. 很显然,是ARC的问题. 错误原因:在创建工程的时候点选了“Use Aut ...

  3. ios开发之路十一(ARC forbids explicit message send of 'autorelease'错误)

    在ios中经常会遇到:ARC forbids explicit message send of 'autorelease' 或“ARC forbids explicit message send of ...

  4. ARC forbids explicit message send of 'autorelease'错误

    (ARC forbids explicit message send of 'autorelease'错误) 在ios中经常会遇到:ARC forbids explicit message send ...

  5. ARC forbids explicit message send of'retain'解决办法

    项目中导入一些开源的类库,里面会爆出一些ARC forbids explicit message send of'retain' 这种问题 解决方法: 点击项目Target -> 找到" ...

  6. libXml ARC forbids explicit message send of'release'

    'release' is unavailable: not available in automatic reference counting mode ARC forbids explicit me ...

  7. ARC forbids explicit message send of release

    http://blog.sina.com.cn/s/blog_7b9d64af01019rqt.html

  8. Object C学习笔记5-ARC forbids explicit message* 编译错误

    在学习Object C的过程中XCode 编译器经常出现 "ARC forbids explicit message send of release" 的错误提示. 以上问题主要出 ...

  9. android中handler中 obtainmessge与New message区别

    obtainmessage()是从消息池中拿来一个msg 不需要另开辟空间new new需要重新申请,效率低,obtianmessage可以循环利用: //use Handler.obtainMess ...

随机推荐

  1. [javascript svg fill stroke stroke-width circle 属性讲解] svg fill stroke stroke-width circle 属性 绘制圆形及引入方式讲解

    <!DOCTYPE html> <html lang='zh-cn'> <head> <title>Insert you title</title ...

  2. 需要记住的几个ASCII码

    --------- A--------- a---------

  3. Net.Sf.Json java Object to JsonObject

    public class People{ private String name; public void setName(String name){ this.name = name; } publ ...

  4. 【代码笔记】iOS-对iphone手机进行判断的一些函数

    代码: #import "RootViewController.h" //为判断手机的型号 -(NSString*)deviceString添加头文件 #import " ...

  5. 【Android自定义控件】支持多层嵌套RadioButton的RadioGroup

    前言 非常喜欢用RadioButton+RadioGroup做Tabs,能自动处理选中等效果,但是自带的RadioGroup不支持嵌套RadioButton(从源码可看出仅仅是判断子控件是不是Radi ...

  6. [Android]listview recycleview的复用问题

    最近解决了几个bug,是关于listview和recycle view中的复用问题的:   为了提高性能,我们使用了viewHolder来减少view的生成,从而提高滑动的性能:   要注意一个很隐蔽 ...

  7. iOS开发之UIAlertView与UIAlertController的详尽用法说明

    本文将从四个方面对IOS开发中UIAlertView与UIAlertController的用法进行讲解: 一.UIAlertView与UIAlertController是什么东东? 二.我们为什么要用 ...

  8. 搭建Maven私服-续

    前几天搭建了Maven私服,但是想在外网访问只能通过ip地址,因为公司用的不是固定ip所以,ip地址每次不一样,都要先打开极路由查看一下当前ip才能用,更恶心的是,代码check out只能一次,下次 ...

  9. iOS & Mac JSON To Model

    NSString * jsonPath=[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Cont ...

  10. 怎么样使用yum来安装、卸载jdk

    安装好的CentOS会自带OpenJdk,用命令 java -version ,会有下面的信息: java version "1.6.0"OpenJDK  Runtime Envi ...