Re: method_exchangeImplementations problem
Re: method_exchangeImplementations problem
- Subject: Re: method_exchangeImplementations problem
- From: Terry Lambert <email@hidden>
- Date: Fri, 4 Sep 2009 15:06:05 -0700
On Sep 4, 2009, at 6:33 AM, Donnie Lee wrote:
Hello!
I'd like to override delegate functions in Cocoa app. They are in
Class1 and Class2 (which is an instance of Class1). I get these
classes via objc_getClass(). Then I coded two functions and add them
to classes using class_addMethod(). Then I called
method_exchangeImplementations() for both of them.
Replaced delegate for Class1 works fine. But replaced delegate for
Class2 don't work. It starts working only for new instances of Class1
(and Class2 as Class1 instance variable), but don't work for original
instance. How to make it work?
PS: First I tried to use categories to override these delegates, but
for x86_64 linker don't link it as "lazy bound", even with "-undefined
dynamic_lookup" (i386 do it fine). Am I right that its impossible to
use categories anymore?
objc_getClass() is documented as returning the meta class instead of
the class. I think you are possibly calling this on class 1 twice.
If this doesn't turn out to be the case, you should provide a small
code project as part of the bug report you file.
-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden