Friday, 15 May 2015

nsnotificationcenter - Test if NSObject is observing string -


I have NSObject that listens to ~ 30 string signals I have the strings on this object I want to post any number. But first of all I want to see if it is watching the current string.

The document for [NSNotificationCenter] [1] is not suggesting that it is possible. Only posting / removing the removed supervisor, and posting the notification method

Documentation for KVO I think this is the [[NSNotificationCenter defaultCenter] ObservationInfo] method of Is possible using. I have no clue how to use zero * returned. The document returns the value value:

An indicator that identifies information about all supervisors who are registered with the receiver, options which were used in registration-time, and so on .

I especially appreciate "and so on" This was the most useful part ... sigh

Looking at the number of signals handling the object , I do not want to manually check each string. Whether or not the object is trying to string at the NSObject level or KVO level is a great way to check that does not use the private API?

Thank you "post-text" itemprop = "text">

It's just a token from the header (emphasis Khan):

Return or return an indicator that identifies information about all the supervisors registered with the receiver, to be used at registration time. Options The default implementation of these methods stores the observation information collected by the receivers pointers in a global dictionary. For better performance, you can override these methods to store opaque data pointer in an example variable. These methods should not attempt to send objective messages to the information of the superficial pass-in observation, including the reverse-and-reel.

In addition to this, the comments of the KVO comments and the NS Annotation Center are not related to the two, to find out what is watching, any public The API does not provide the only way I can imagine to track inspections. Only the add / remove methods have to be overridden (either with method overrides for KVO or on NSNotificationCenter By fasting) and then keep track of the information of the observation itself.

I do not mean "that man", but wants to know which one is usually showing a red flag that some are not well-architectural. If you are worried about performance, then I would not have the KVO and NS Annotation Center very fast / lower overhead mechanism. ~ 30 comments are not either. I do not care about it

No comments:

Post a Comment