在 ARC 中,我知道你不会在 -dealloc
的任何覆盖中调用 [super dealloc]
,所以通常我会删除那里的观察者和计时器而不做所以。但是,如果我将我创建的 View 子类化,该 View 在 -dealloc
中发布观察信息,而不在子类的方法实现中调用 [super dealloc]
,会不会super实现自动调用释放父类(super class)处理的观察信息,否则会泄漏吗?
最佳答案
dealloc
的父类(super class)实现会自动调用(据我所知,编译器会为您插入语句[super dealloc]
)。
更新
这里是引用:
Custom dealloc methods in ARC do not require a call to [super dealloc] (it actually results in a compiler error). The chaining to super is automated and enforced by the compiler. Transitioning to ARC Release Notes
关于objective-c - ARC 子类上的 super dealloc,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25377522/