Ruibin.Chow
Ruibin.Chow

Reputation: 93

About the KVO reference count

When I use

addObserver:forKeyPath:options:context: 

In this method, will the observer be a strong reference or just a weak reference in ARC?

Any ideas for this problematic?

Upvotes: 1

Views: 647

Answers (1)

DAXaholic
DAXaholic

Reputation: 35358

See the documentation 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.

In short: The method does not maintain a strong reference to the observer.

Upvotes: 3

Related Questions