报错cannot assign to 'self' outside of a method in the init family

来源:互联网 发布:淘宝客服删除聊天记录 编辑:程序博客网 时间:2024/06/06 02:39

报错cannot assign  to 'self' outside of a method in the init family

有时候重写父类init方法时,不注意将init后面第一个字母小写,在这个方法里调用父类的初始化方法self = [super init];时会报错如下 cannot assign  to 'self' outside of a method in the init family

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

阅读全文
0 0
原创粉丝点击