Is there a way to know which is the list of observers for a specific instance ?
How am I suppose to use observationInfo, could you provide an example ?
thanks
There is a write-up of how to use observationInfo in "Technical Note TN2124: Mac OS X Debugging Magic." The idea is that you can use it in the debugger to discover the information you need.
Not only that, but I tried using it like this:
id what = [self observationInfo];
NSLog(@"%@", [what description]);
and this is what I got in the log:
<NSKeyValueObservationInfo 0x7fdb8953c380> (
<NSKeyValueObservance 0x7fdb8953c270: Observer: 0x7fdb8953bf60, Key path: subscribed, Options: <New: NO, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fdb8953c350>
)
('subscribed' is an ivar in one of my own objects)
There doesn't appear to be a public interface either for NSKeyValueObservationInfo or NSKeyValueObservance.
It appears I got the benefit of learning something new from your question!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With