本文介绍了ARC子类上的超级解除分配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ARC中,我知道您不会在-dealloc的任何替代中调用[super dealloc],因此通常我不这样做而删除其中的观察者和计时器.但是,如果我要细分一个使在-dealloc中释放观察信息而不在该方法的子类的实现中调用[super dealloc]的视图的子类,那么将自动调用super实现以释放由超类处理的观察信息,还是会泄漏?

In ARC I'm aware that you do not call [super dealloc] in any overrides of -dealloc, so typically I remove observers and timers in there without doing so. However, if I were to subclass a view that I made that releases observation info in -dealloc without calling [super dealloc] in the subclass' implementation of the method, would the super implementation be called automatically to release the observation info handled by the superclass, or would it leak?

推荐答案

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

The superclass' implementation of dealloc is automatically called (as far as I know, the compiler inserts the statement [super dealloc] for you).

到LLVM文档的外部链接

这里是参考:

这篇关于ARC子类上的超级解除分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 17:30