[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSNotificationCenter problem

From: Wolfgang Lux
Subject: Re: NSNotificationCenter problem
Date: Thu, 1 Nov 2007 23:40:27 +0100

Am 01.11.2007 um 19:48 schrieb Truls Becken:

On Nov 1, 2007 11:15 AM, Andreas Höschler <address@hidden> 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

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

The other option (though now deprecated in Leopard) is to write a
subclass of NSNotificationCenter which implements removeObserver and
then call +poseAsClass: at a suitable point during the initialization
of your program.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]