I have a NSObject
that listens for ~30 string signals. I want to post any number of strings to this object. But I first want to test to see if it's observing the current string.
The documentation for [NSNotificationCenter][1]
doesn't suggest this is possible. There are only add/remove remove observer, and post notification methods.
The documentation for KVO makes me think this may be possible using the [[NSNotificationCenter defaultCenter] observationInfo]
method. I don't have a clue how I would use the returned void*
. The documentation states the return value:
A pointer that identifies information about all of the observers that are registered with the receiver, the options that were used at registration-time, and so on.
I especially appreciate the "and so on". That was the most helpful part...sigh.
Considering the number of signals the object is handling, I don't want to manually check each string. Is there a graceful way to check whether the object is observing a string (try/catch doesn't qualify) at the NSObject level or KVO level that doesn't use private API?
Thanks.