当我使用
addObserver:forKeyPath:options:context:
在这个方法中,观察者是ARC中的强引用还是弱引用?
对这个问题有什么想法吗?
最佳答案
参见文档 here
Note: The key-value observing addObserver:forKeyPath:options:context: method does not maintain strong references to the observing object, the observed objects, or the context. You should ensure that you maintain strong references to the observing, and observed, objects, and the context as necessary.
简而言之:该方法不维护对观察者的强引用。
关于ios - 关于 KVO 引用计数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36193546/