unrecognized selector sent to instance
来源:互联网 发布:大数据未来前景 编辑:程序博客网 时间:2024/05/21 23:26
造成unrecognized selector sent to instance XXX,大部分情况下是因为对象被提前release了,在你心里不希望他release的情况下,指针还在,对象已经不在了。
很多时候,是因为init初始化函数中,对属性赋值没有使用self.foo赋值,而是直接对foo赋值,导致属性对象没有retain(心里以为retain了),而提前释放。
问题解决链接:http://www.devdiv.com/thread-30546-1-1.html
问题的进一步分析:
@interface MyClass : NSObject {
MyObject *myObject;
}
@property (nonatomic, retain) MyObject *myObject;
@end
对于self.myObject = xxx调用。你将访问由@property这里面自动给你提供的一些函数。这些函数会帮你增加引用计数。
对于myObject = xxx这种调用。相当于你直接访问花括号里面的那个,即直接给myObject赋值但是没有增加引用计数。可能造成的情况就是在你要使用myObject之前,它已经释放了。
- unrecognized selector sent to instance
- unrecognized selector sent to instance
- unrecognized selector sent to instance
- unrecognized selector sent to instance
- unrecognized selector sent to instance
- unrecognized selector sent to instance
- unrecognized selector sent to instance
- unrecognized selector sent to instance
- unrecognized selector sent to instance
- unrecognized selector sent to instance
- unrecognized selector sent to instance
- unrecognized selector sent to instance 解决办法
- NSString category:unrecognized selector sent to instance
- "unrecognized selector sent to instance *****"的错误
- Bug分析:unrecognized selector sent to instance
- -[NSDecimalNumber isEqualToString:]: unrecognized selector sent to instance
- [UIView numberOfComponentsInPickerView:]: unrecognized selector sent to instance
- unrecognized selector sent to instance 原因
- leeboy的linux学习十三环境变量实例
- QWidget与HWND的互相转换
- 腾讯开放平台开发之感
- AdaBoost中利用Haar特征进行人脸识别算法分析与总结2——级联分类器与检测过程
- 在mac下添加环境变量
- unrecognized selector sent to instance
- LaTeX之公式及编号
- STM32F系列JTAG口重映射成为普通GPIO
- Android Camera 架构
- 车子内部雾刷
- oracle处理数据
- MPEG2压缩编码技术应用原理
- 错误总结:error LNK2001
- iPhone5预测:在微创新中逐渐沦陷[转]