Bug分析:unrecognized selector sent to instance
来源:互联网 发布:php解析视频 编辑:程序博客网 时间:2024/05/01 09:41
对于unrecognized selector sent to instance XXX的bug,大部分情况下是因为对象被提前release了,在你并不希望他release的情况下,指针还在,对象已经不在了。
很多时候,是因为init初始化函数中,对属性赋值没有使用self.foo赋值,而是直接对foo赋值,导致属性对象没有retain(心里以为retain了),而提前释放。
问题的进一步分析:
@interface MyClass : NSObject {
MyObject *myObject;
}
@property (nonatomic, retain) MyObject *myObject;
@end
对于self.myObject = xxx调用。你将访问由@property这里面自动给你提供的一些函数。这些函数会帮你增加引用计数。
对于myObject = xxx这种调用。相当于你直接访问花括号里面的那个,即直接给myObject赋值但是没有增加引用计数。可能造成的情况就是在你要使用myObject之前,它已经释放了。
- Bug分析: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
- iOS BUG收集: -[__NSCFNumber rangeOfCharacterFromSet:]: unrecognized selector sent to instance
- unrecognized selector sent to instance 解决办法
- NSString category:unrecognized selector sent to instance
- "unrecognized selector sent to instance *****"的错误
- -[NSDecimalNumber isEqualToString:]: unrecognized selector sent to instance
- [UIView numberOfComponentsInPickerView:]: unrecognized selector sent to instance
- Linux rpm(redhat package manager)安装包介绍
- Linux 环境变量
- Rapidsvn 版本管理客户端工具简单用法
- redHat tomcat开机自启动
- 各种网络环境渗透测试概述
- Bug分析:unrecognized selector sent to instance
- SVN 基础配置和版本还原操作试用
- (书摘)牛奶可乐经济学之成本效益原则
- equals与==区别
- 快递的保价限制
- vim中空格缩进的配置
- jsp代码列表数据加上序号
- 赋值中的类型转换
- Windows内核编程的一个小例子