有时候我们重写父类的init方法时不注意将init后面的第一个字母写成了小写,在这个方法里面又调用父类的初始化方法(self = [super init];)时会报错,错误信息如下:error:Cannot assign to 'self' outside of a method in the init family

原因:只能在init方法中给self赋值,Xcode判断是否为init方法规则:方法返回id,并且名字以init+大写字母开头+其他  为准则。例如:- (id) initWithXXX;

出错代码:- (id) Myinit{

self = [super init];

……

}

解决方法:- (id) initWithMy

{

self = [super init];

}

关于error:Cannot assign to 'self' outside of a method in the init family的更多相关文章

  1. 关于error:Cannot assign to 'self' outside of a method in the init family

    有时候我们重写父类的init方法时不注意将init后面的第一个字母写成了小写.在这种方法里面又调用父类的初始化方法(self = [super init];)时会报错,错误信息例如以下:error:C ...

  2. vue运行报错error:Cannot assign to read only property 'exports' of object '#<Object>'

    用weex做项目的时候,npm start 之后一直报错error:Cannot assign to read only property 'exports' of object '#<Obje ...

  3. sdk uncaught third Error Cannot assign to read only property 'constructor' of object '#<V>' (小程序)

    sdk uncaught third Error Cannot assign to read only property 'constructor' of object '#<V>' 在a ...

  4. Cannot assign to 'self' outside of a method in the init family

    今天在重写父类的init方法时报错如下: error:Cannot assign to 'self' outside of a method in the init family 这种问题以前从来没有 ...

  5. 关于Cannot assign to 'self' outside of a method in the init family解决方法

    有时候我们重写父类的init方法时不注意将init后面的第一个字母写成了小写,在这个方法里面又调用父类的初始化方法(self = [super init];)时会报错,错误信息如下:error:Can ...

  6. Xcode工程编译错误:“Cannot assign to 'self' outside of a method in the init family”

    #import <Foundation/Foundation.h> @interface EOCRectangle : NSObject<NSCoding> @property ...

  7. TypeError: Error when calling the metaclass bases Cannot create a consistent method resolution

    Python Error when calling the metaclass bases Cannot create a consistent method resolution order (MR ...

  8. Error creating bean with name &#39;menuController&#39;: Injection of autowired dependency……

    出现了一大串错误 Error creating bean with name 'userController': Injection of autowired dependencies failed. ...

  9. Error creating bean with name &#39;memcachedClient&#39;...java.lang.OutOfMemoryError

    1,Tomcat启动报错例如以下: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating ...

随机推荐

  1. elasticsearch6.4 memory locking requested for elasticsearch process but memory is not locked 终极解决

    echo "es hard memlock unlimited">>/etc/security/limits.confecho "es soft memloc ...

  2. 安卓程序代写 网上程序代写[转]eclipse快捷键

    F 键类 F2 显示详细信息 F3 跳到声明或定义的地方 Ctrl + 键类 Ctrl+1 快速修复 ( 最经典的快捷键 , 就不用多说了 ) Ctrl+D 删除当前行 Ctrl+E 快速显示当前 E ...

  3. 【转】一个小妙招能让你在服装上省下好多rmb

    朋友们,你们仔细算过自己每年在淘宝上买衣服消费了多少rmb吗?100?1000?10000?甚至更多? 朋友们,你知道淘宝上大多数店铺的衣服是哪里来的吗? 朋友们,你知道怎么在这上面能节省更多的mon ...

  4. 使用 pv 命令监控 linux 命令的执行进度

    如果你是一个 linux 系统管理员,那么毫无疑问你必须花费大量的工作时间在命令行上:安装和卸载软件,监视系统状态,复制.移动.删除文件,查错,等等.很多时候都是你输入一个命令,然后等待很长时间直到执 ...

  5. 反编译CMD命令

    1.反XML命令 E:\HuaWei Tools\android\apktool-install-windows-r04-brut1 java -jar AXMLPrinter2.jar  guide ...

  6. (笔记)Linux Root下的.gvfs出现异常解决办法

    在linux系统下安装软件或复制文件的时候,复制不成功,出现错误如下: error: failed to stat /home/dade/.gvfs: Permission denied. 表面上看: ...

  7. (笔记)linux设备驱动--LED驱动

    linux设备驱动--LED驱动 最近正在学习设备驱动开发,因此打算写一个系列博客,即是对自己学习的一个总结,也是对自己的一个督促,有不对,不足,需要改正的地方还望大家指出,而且希望结识志同道合的朋友 ...

  8. Linux 下查看某个进程运行的堆栈信息

    1. 根据进程名称查询进程ID ps -ef | grep processName 2. 将进程的堆栈信息写入log gstack processId > s.log 3. 查看log vim ...

  9. can 驱动

    http://www.cnblogs.com/general001/articles/2342728.html http://blog.csdn.net/luoqindong/article/deta ...

  10. 嵌入式开发值zynq---zynq中tlv320aic23b spi的驱动移植

    http://blog.csdn.net/djason43/article/details/52876742 http://blog.csdn.net/lxmky/article/details/68 ...