On Nov 1, 2007 11:15 AM, Andreas Höschler <ahoesch@smartsoft.de>
wrote:
Any idea how this can be tracked done efficiently (with gdb)? Under
GNUstep I would raise an exception in if removeObserver
notificationName is SOInvalidatedAllObjectsInStoreNotification but on
MacOSX I cannot simply alter and recompile the code of
NSNotificationCenter.
There is a trick known as method swizzling that lets you replace a
method and call the original implementation.
Basically, you add a method with a new name and have it call itself.
Then you swap (or swizzle) the implementations of the two methods, so
that your method goes by the name of the one you want to replace. When
your method sends a message with the new selector, it will actually
execute the original implementation.
For code and more info, see http://www.cocoadev.com/index.pl?
MethodSwizzling