Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does adding a KVO observer to self cause a memory leak?

In a nsobject you have a property "keyPath" you want to observe itself and you use

[self addObserver:self forKeyPath:keyPath options:NSKeyValueObservingOptionNew context:nil];

Does the above line cause a retain cycle?

I present this question because I wanted to know if it was a viable alternative to rewriting a bunch of setter functions.

like image 883
Biclops Avatar asked Apr 06 '14 06:04

Biclops


1 Answers

From the docs:

Neither the receiver, nor anObserver, are retained.

like image 112
zadr Avatar answered Sep 24 '22 06:09

zadr