You have to include objc runtime header to use runtime methods.

#include <objc/runtime.h>

Le 31 mai 2010 à 15:03, Rafael Cerioli a écrit :

> Hi,
> 
> I guess you need the framework libobjc.A.dylib for that stuff.
> 
> 
> Rafael
> 
> Le 31 mai 2010 à 08:45, Louis-Philippe a écrit :
> 
>> Hi,
>> 
>> I am trying to add dynamic class methods to a class,
>> I implement:
>> 
>> @implementation MyClass
>> 
>> + (BOOL)resolveClassMethod:(SEL)sel
>> {
>> if (sel == @selector(MySel)) {
>> class_addMethod(R3DSDKMeta.self, sel, (IMP)dynamicMethodIMP, "*@:");
>> return YES;
>> } else {
>> return NO;
>> }
>> 
>> }
>> 
>> NSString* dynamicMethodIMP(id self,SEL _cmd) {
>> return @"OK!";
>> }
>> 
>> @end
>> 
>> and get a:
>> 
>> "class_addMethod was not declared in this scope"
>> 
>> I tried for a few hours to debug this, but I am puzzled...
>> any ideas?
>> _______________________________________________
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/rafael.cerioli%40gmail.com
>> 
>> This email sent to rafael.ceri...@gmail.com
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org
> 
> This email sent to devli...@shadowlab.org

-- Jean-Daniel




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to