关于error:Cannot assign to 'self' outside of a method in the init family
有时候我们重写父类的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的更多相关文章
- 关于error:Cannot assign to 'self' outside of a method in the init family
有时候我们重写父类的init方法时不注意将init后面的第一个字母写成了小写,在这个方法里面又调用父类的初始化方法(self = [super init];)时会报错,错误信息如下:error:Can ...
- 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 ...
- 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 ...
- 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 这种问题以前从来没有 ...
- 关于Cannot assign to 'self' outside of a method in the init family解决方法
有时候我们重写父类的init方法时不注意将init后面的第一个字母写成了小写,在这个方法里面又调用父类的初始化方法(self = [super init];)时会报错,错误信息如下:error:Can ...
- Xcode工程编译错误:“Cannot assign to 'self' outside of a method in the init family”
#import <Foundation/Foundation.h> @interface EOCRectangle : NSObject<NSCoding> @property ...
- 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 ...
- Error creating bean with name 'menuController': Injection of autowired dependency……
出现了一大串错误 Error creating bean with name 'userController': Injection of autowired dependencies failed. ...
- Error creating bean with name 'memcachedClient'...java.lang.OutOfMemoryError
1,Tomcat启动报错例如以下: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating ...
随机推荐
- HDU-3315 My Brute
先对于每种可能的PK情况进行判断胜负,然后求最小改动最大匹配. #include <cstdlib> #include <cstdio> #include <cstrin ...
- 搜索引擎快捷导航:一个简单的chrome插件(教程)
一.如何通过练习来提高学习新框架的最好姿势是:基于现有的业务来学习.即从工作中学习,从实践中学.但是,如果一直只使用新的框架来重写旧的业务,成长也会趋近于0.第一次,使用新框架时收获可能颇丰:第二次, ...
- 基于openstack stable queens版本阅读解析
基于openstack stable queens版本阅读解析 基于 centos7.5 的linux系统 架构 如下所示,为cinder的官方架构说明: 这里写图片描述 各个组件介绍如下: - DB ...
- [BZOJ4260] Codechef REBXOR (01字典树,异或前缀和)
Description Input 输入数据的第一行包含一个整数N,表示数组中的元素个数. 第二行包含N个整数A1,A2,-,AN. Output 输出一行包含给定表达式可能的最大值. Sample ...
- bzoj 4009 接水果 整体二分
Description 先给出一些盘子, 用路径x-y表示, 有权值 再有Q个询问, 表示水果, 用路径x-y表示 如果盘子是水果的子路径, 可以接住 对于每个水果, 输出可以接住它的盘子的第k小权 ...
- POJ1167 The Buses
Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 6234 Accepted: 1698 Description A man ...
- 标准C程序设计七---65
Linux应用 编程深入 语言编程 标准C程序设计七---经典C11程序设计 以下内容为阅读: <标准C程序设计>(第7版) 作者 ...
- AC日记——Milking Grid poj 2185
Milking Grid Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 8314 Accepted: 3586 Desc ...
- gitlab详解
a.安装并创建用户 yum -y install curl policycoreutils policycoreutils-python openssh-server openssh-clients ...
- jenkins集群节点构建maven(几乎是坑最多的)
业务量变大时,单台的jenkins进行自动化构建部署,就显得没那么灵活,jenkins的集群并非像web服务器.mysql集群那样,jenkins的集群无需在额外的主机安装jenkins,但是用于ja ...