Cannot assign to 'self' outside of a method in the init family
来源:互联网 发布:mac 快捷键弹出qq消息 编辑:程序博客网 时间:2024/05/17 05:01
有时候我们重写父类的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) Myinit{
}
解决方法:- (id) initWithMy
{
}
转载地址:http://blog.csdn.net/qi_ruihua/article/details/19981215
0 0
- cannot assign to 'self' outside of a method in the init family
- Cannot assign to 'self' outside of a method in the init family
- 关于error:Cannot assign to 'self' outside of a method in the init family
- 关于error:Cannot assign to 'self' outside of a method in the init family
- Cannot assign to 'self' outside of a method in the init family
- Cannot assign to 'self' outside of a method in the init family
- [IOS] 错误:Cannot assign to 'self' outside of a method in the init family
- [ios]关于error:Cannot assign to 'self' outside of a method in the init family
- 关于error:Cannot assign to 'self' outside of a method in the init family
- 关于error:Cannot assign to 'self' outside of a method in the init family
- 关于error:Cannot assign to 'self' outside of a method in the init family
- 关于error:Cannot assign to \'self\' outside of a method in the init family
- Cannot assign to 'self' outside of a method in the init family
- Cannot assign to 'self' outside of a method in the init family
- 关于error:Cannot assign to 'self' outside of a method in the init family
- Cannot assign to 'self' outside of a method in the init family
- 关于error:Cannot assign to 'self' outside of a method in the init family
- 子类中初始化错误Cannot assign to ’self’ outside of a method in the init family
- 如何让服务只运行单个实例
- 程序员的奋斗史(三十一)——人在囧途之应聘篇(一)
- input控件 密码赋值问题
- Shell中的空格(space)的“必须有”与“不能有”
- 修改struct2 的后缀
- Cannot assign to 'self' outside of a method in the init family
- 一米阳光看世界
- MyBatis自我理解
- NOIP2009 提高组 靶形数独 题解
- java编译错误: 非法字符: \65279
- 如何理解指向指针的指针?
- javascript 对象转换成字符串
- 程序员的奋斗史(三十二)——人在囧途之应聘篇(二)
- 好文章——王垠:如何掌握程序语言