Skip navigation.
 
mlRe: NSNotificationCenter problem
FROM : Bill Bumgarner
DATE : Tue Nov 06 08:45:56 2007

On Nov 5, 2007, at 11:42 PM, Bill Bumgarner wrote:
> You can still swizzle methods, you just can't do it in the raw Obj-C 
> structures.  It is still considered naughty, but at least there is 
> API via which you can commit the naughtiness in a somewhat 
> predictable fashion (i.e. it'll do the right thing in terms of 
> threading & cache flushing, but you'll still be hosed if you put the 
> wrong IMP somewhere).
>
> Specifically:
>
>     OBJC_EXPORT BOOL class_addMethod(Class cls, SEL name, IMP imp, 
> const char *types);
>     OBJC_EXPORT IMP class_replaceMethod(Class cls, SEL name, IMP imp, 
> const char *types);


Dang it.  Hit deliver too soon.  The whole point was also to say that 
these APIs are available in the 32 bit -- the legacy ObjC -- runtime, 
too.  You can write one bit of code that'll behave the same in 32 bit 
and 64 bit.

Convenient and consistent, but it doesn't make it any more of a good 
idea to go and class_replaceMethod() on just any method of any class. ;)

b.bum

Related mailsAuthorDate
mlNSNotificationCenter problem Andreas Höschler Nov 1, 11:15
mlRe: NSNotificationCenter problem Christiaan Hofman Nov 1, 11:44
mlRe: NSNotificationCenter problem Scott Stevenson Nov 2, 02:28
mlRe: NSNotificationCenter problem Christiaan Hofman Nov 2, 10:59
mlRe: NSNotificationCenter problem Adam R. Maxwell Nov 2, 16:51
mlRe: NSNotificationCenter problem Christiaan Hofman Nov 2, 18:02
mlRe: NSNotificationCenter problem Adam R. Maxwell Nov 2, 18:28
mlRe: NSNotificationCenter problem Scott Stevenson Nov 6, 07:55
mlRe: NSNotificationCenter problem Bill Bumgarner Nov 6, 08:42
mlRe: NSNotificationCenter problem Bill Bumgarner Nov 6, 08:45
mlRe: NSNotificationCenter problem Scott Stevenson Nov 6, 10:58