本文介绍了点符号dealloc?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
It's bad practice to use your setter methods in -dealloc. Use [name release] instead.
-dealloc $ c时调用setters $ c>可能有意想不到的后果。如果使用KVO,设置属性可能会触发其他代码运行导致副作用,因为您的对象已经开始释放实例变量。即使不使用KVO,如果您的setter方法依赖于可能已经释放的其他实例变量,这可能会导致潜在的问题。
Calling setters during -dealloc may have unintended consequences. If using KVO, setting properties may trigger other code to run causing side effects because your object has already started releasing instance variables. Even when not using KVO this may cause potential problems if your setter method relies on other instance variables that may have already been released.
(更新以反映注释)
这篇关于点符号dealloc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!