Why the Observer in NSNotification called twice....?

cocoa, notifications, objective-c

Solution

If the observer class is registered for a notification by name, but not against a specific object, it will receive multiple messages, as it will be invoked every time the notification occurs, regardless of the originating object.

Likewise, if the observer is registered against a specific object, but not against a named notification, it will be messaged every time there is a notification concerning that object.

An alternative mechanism for being informed of changes in a distant state, is Key Value observing -http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html

Problem

If the class is a custom class, after posting the notification, the selector corresponding to the observer is called twice.. Is there any better solution so that the selector is called only once?

Original source