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.

有帮助吗?

解决方案

From the docs:

Neither the receiver, nor anObserver, are retained.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top