discuss-gnustep
[Top][All Lists]
Advanced

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

Re: NSNotificationCenter problem


From: Truls Becken
Subject: Re: NSNotificationCenter problem
Date: Thu, 1 Nov 2007 19:48:09 +0100

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 removeObserver if
> 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

Cheers,
Truls

reply via email to

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