objective-c - ARC 子类上的 super dealloc

标签 objective-c memory-management automatic-ref-counting

在 ARC 中,我知道你不会在 -dealloc 的任何覆盖中调用 [super dealloc],所以通常我会删除那里的观察者和计时器而不做所以。但是,如果我将我创建的 View 子类化,该 View 在 -dealloc 中发布观察信息,而不在子类的方法实现中调用 [super dealloc] ,会不会super实现自动调用释放父类(super class)处理的观察信息,否则会泄漏吗?

最佳答案

dealloc 的父类(super class)实现会自动调用(据我所知,编译器会为您插入语句[super dealloc])。

External link to LLVM docs

更新

这里是引用:

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

enter image description here

关于objective-c - ARC 子类上的 super dealloc,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25377522/

相关文章:

objective-c - NSButton 未响应 PerformSelector :

c - 高效的 C 池分配器?

c - free() 指针

ios - 升级部署目标时 dispatch_release 编译器错误

objective-c - 在 ARC 下返回 NSString 时如何避免临时对象

Objective-C:使用实例变量覆盖 Getter 和 Setter(使用 _)

ios - 更新约束不会改变框架

c++ - 删除类型转换指针的最佳方法

objective-c - CoreData 如何使用 Search 和 ARC 过滤 NSFetchedResultsController

iphone - 在一个 View Controller 和 UAModalPanel 之间保留 View