在ARC中,我们是否需要显式发送removeObserver :? [英] In ARC do we need to send removeObserver: explicitly?

查看:88
本文介绍了在ARC中,我们是否需要显式发送removeObserver :?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于以前作为观察者添加到NSNotificationCenter的对象,我们是否必须显式发送removeObserver:?

Do we have to send removeObserver: explicitly for objects that have been added as observers to an NSNotificationCenter before?

我有点困惑,无法找到确切的答案.

I am bit confused and unable to find the exact answer for this.

请提供详细信息,包括为什么我们需要显式删除removeObserver,以及为什么编译器不将其隐式地放在类/应用程序中?

Please provide me in detail, about this including why we need to removeObserver explicitly, and why don't compiler put it implicitly in class/application?

推荐答案

是的,如果您没有观察到的类可以调用观察者的所有已释放实例,则需要调用removeObserver:.

Yes, you need to call removeObserver:, if you don't the observed class could call all deallocated instance of the observer.

这篇关于在ARC中,我们是否需要显式发送removeObserver :?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆