You can access ivars
just
#include "objc/objc-class.h"
and then use
static Ivar theIvar; //create a static to cache the ivar information
if (!theIvar) theIvar = class_getInstanceVariable([self class],
"ivarName"); //look up the ivar information and cache it
id aValue =
ually worry
me all that much.
Paul Sanders.
- Original Message -
From: "Bill Bumgarner"
To: "Gideon King"
Cc: "Cocoa Dev"
Sent: Friday, March 12, 2010 6:36 AM
Subject: Re: Switching methods in private classes in Apple
frameworks
Where "careful about
Wow, that's really, really awesome.
Do you have any more details on why you can't use ivars? Not calling
super makes sense. Can you access properties?
On Mar 11, 2010, at 8:58 PM, Gideon King wrote:
Thanks Jerry, I should mention that I did get this caveat note from
Greg Parker (Apple's "ru
Method exchange is dangerous because if the target class
(NSConcreteNotification) does not override the target function (dealloc), you
may exchange it's superclass dealloc method instead and may end up overriding a
method in a base class.
Use it with great care and avoid it in production code i
On Mar 11, 2010, at 8:58 PM, Gideon King wrote:
> So as long as you are careful about what you do, yes it is entirely possible
> to replace methods at will. I hope nobody misuses it, but it certainly was
> essential in my debugging - yes, I found it! Yay!
Where "careful about what you do" inc
Thanks Jerry, I should mention that I did get this caveat note from Greg Parker
(Apple's "runtime wrangler"):
"..you must be cautious about what your replacement method does. In particular,
you must not use any of the class's ivars and you must not call [super
something]. As long as you follow
On 2010 Mar 11, at 18:00, Gideon King wrote:
> This is really cool...so I can replace a method without being a subclass or
> category.
I just need to chime in here, in case anyone missed it, to emphasize how
*ALL-CAPS COOL* this is indeed.
In the ReadMe of Apple's MethodReplacement.zip sample
This is really cool...so I can replace a method without being a subclass or
category.
So I implemented an NSObject subclass with the new method, and did the method
exchange, and my new method was called instead of the old one, but I had a
problem - the call to the switched out method (dealloc
On Mar 11, 2010, at 4:24 PM, Gideon King wrote:
> (following on from the thread "How to debug this error on closing a
> document?", but it's really moved on to a new topic at this point)
>
> I was not aware that poseAsClass is not available in 64 bit applications. I
> looked at the Apple example
(following on from the thread "How to debug this error on closing a document?",
but it's really moved on to a new topic at this point)
I was not aware that poseAsClass is not available in 64 bit applications. I
looked at the Apple example of exchanging a method in NSWindow, and it looked
easy e
10 matches
Mail list logo