有时候我们重写父类的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];

}

转载自http://www.aichengxu.com/view/34741

关于Cannot assign to 'self' outside of a method in the init family解决方法的更多相关文章

  1. 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 这种问题以前从来没有 ...

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

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

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

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

  4. 关于vue-cli3打包时遇到Cannot assign to read only property 'exports' of object '#<Object>'问题的解决方法。

    vue-cli3打包时遇到Cannot assign to read only property 'exports' of object '#<Object>'问题的解决方法. 大致是说, ...

  5. 关于error:Cannot assign to &#39;self&#39; outside of a method in the init family

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

  6. php连接memcahed出现Cannot assign requested address (99)的解决方法

    今天在将服务器合并后,发现php偶尔会报出 Server *.*.*.* (tcp *****) failed with: Cannot assign requested address (99) 的 ...

  7. Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#<Object>‘的解决方法

    发现问题 运行一下以前的一个Vue+webpack的 vue仿新闻网站  小项目,报错 由于自己vue学习不深入,老是这个报错,找了好久(确切的说是整整一下午^...^)才找到原因 -v- Uncau ...

  8. tomcat java.net.BindException: Cannot assign requested address 解决方法

    今天线上TOMCAT启动时遇到了下比较麻烦的问题,错误如下: 21-Apr-2016 15:14:19.077 SEVERE [main] org.apache.catalina.core.Stand ...

  9. 对于高并发短连接造成Cannot assign requested address解决方法

    https://www.cnblogs.com/dadonggg/p/8778318.html 感谢这篇文章给予的启发 在tcp四次挥手断开连接时,主动释放连接的一方最后会进入TIME_WAIT状态, ...

随机推荐

  1. leetcode 132. Palindrome Partitioning II ----- java

    Given a string s, partition s such that every substring of the partition is a palindrome. Return the ...

  2. ndk-build出错,错误以及解决办法如下

    用NDK编译jni目录下的文件了,我的系统是Ubuntu10.04,NDK版本是android-ndk-r7b. 切换到工程的jni目录下执行:ndk-build(ndk-build的路径已经添加到系 ...

  3. 编写linux驱动所用到的头文件(转)

    转自:http://blog.csdn.net/lufeiop02/article/details/6448497 关于linux驱动(应用)程序头文件使用 收藏 驱动程序: #include < ...

  4. 黑马程序员——JAVA基础之异常处理机制

    ------- android培训.java培训.期待与您交流! ---------- 异常:就是程序在运行时出现不正常情况. 异常由来:问题也是现实生活中一个具体的事物,也可以通过java的类的形式 ...

  5. freeswitch 挂断前执行脚本

    通道变量名 api_hangup_hook 介绍在挂断时执行指定API命令 示例 <action application="set" data="api_hangu ...

  6. NOSQL Benchmarks

    www.planetcassandra.org/nosql-performance-benchmarks/ http://www.planetcassandra.org/nosql-performan ...

  7. 学习smali

    添加控件id 在R$id.smali文件下添加: .field public static final adposition:I = 0x7f05003d 添加类中常量 MainActivity.sm ...

  8. <button>会自动提交表单吗?

    点击button以后,表单先由ajax提交,然后无论后台返回什么结果,页面都会跳转到表单action属性指定的路劲,也就是login.html使用的是html.jquery.javascript,后台 ...

  9. ExtJs 入门教程

    http://www.cnblogs.com/iamlilinfeng/archive/2012/12/31/2840663.html

  10. HTML兼容性设置

    今天碰到了兼容性问题,页面显示空白,打开调试界面,显示信息 “Compatibility View because 'Display intranet sites in Compatibility V ...