ios - 关于 KVO 引用计数

标签 ios key-value-observing

当我使用

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/

相关文章:

ios - 完整世界 GeoJson 未出现在 Google 地球 iOS API 中

ios - 3D模型无法在iOS的ARCore Augmented Faces中渲染

ios - 是否有可能不在 iOS 上推送/呈现预览 Controller

objective-c - 在 NSMutableArray 中观察计数

java - Java中的键值观察

ios - 检测 UIView 在另一个 UIView 中的移动

ios - xcode Interface Builder 背景颜色偏好

ios - 使用 KVO 更改属性时发送通知

iOS Key Value 观察Xcode项目问题

iphone - 使用 NSArray 观察键值