Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
method_exchangeImplementations problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

method_exchangeImplementations problem


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?

Thanks in advance,
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

Visit the Apple Store online or at retail locations.

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.