dealloc Don't Use Accessor Methods in Init and Dealloc
来源:互联网 发布:淘宝短信链接 编辑:程序博客网 时间:2024/05/01 14:06
http://fann.im/blog/2012/08/14/dont-use-accessor-methods-in-init-and-dealloc/
http://stackoverflow.com/questions/8056188/should-i-refer-to-self-property-in-the-init-method-with-arc/8056260#8056260
http://stackoverflow.com/questions/5932677/initializing-a-property-dot-notation/5932733#5932733
Use direct access in partially constructed states, regardless of ARC:
- (id)initWithReminder:(Reminder*)reminder_ { self = [super init]; if (self) { reminder = reminder_; // OR reminder = [reminder_ retain]; } return self;}
This is because self.whatever
will trigger other side effects, such as Key-Value Coding notifications or maybe others (if your class or a subclass overrides setWhatever:
), and that could expose other code to your partially-initialized object.
Some more detail as to why you should use direct access in partially constructed states (ARC || MRC) can be found here.
- dealloc Don't Use Accessor Methods in Init and Dealloc
- 不要在init和dealloc函数中使用Accessor 方法[Don’t Use Accessor Methods in Initializer Methods and dealloc]
- Using Accessors in Init and Dealloc
- 不要在init和dealloc函数中使用accessor
- 不要在init和dealloc函数中使用accessor
- init和dealloc中使用property(accessor)的副作用
- 不要在init和dealloc函数中使用accessor
- 不要在init和dealloc函数中使用accessor
- 不要在init和dealloc函数中使用accessor
- 不要在init和dealloc函数中使用accessor
- 不要在init和dealloc函数中使用accessor
- 不要在init和dealloc函数中使用accessor
- dealloc
- dealloc
- dealloc
- setter方法的内部实现【不要在init和dealloc函数中使用accessor】
- 不要在init和dealloc函数中使用accessor(访问器)
- init viewdidload viewdidunload dealloc
- libgdx 环境搭建
- 仿豌豆荚实现android连接pc方法
- JVM调优总结(三)-基本垃圾回收算法
- Tomcat一步步实现反向代理、负载均衡、内存复制
- SCOPE_IDENTITY和@@identity的区别
- dealloc Don't Use Accessor Methods in Init and Dealloc
- linux下配置虚拟主机
- ztree 添加节点
- JVM调优总结(四)-垃圾回收面临的问题
- Oracle 10G 默认用户名密码及解锁
- 解析BMP GIF JPEG TGA PNG图像格式
- 连接各种数据库驱动
- JVM调优总结(五)-分代垃圾回收详述1
- XtraPivotGrid相关教程整理(二)