• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: dynamic resolution
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dynamic resolution


  • Subject: Re: dynamic resolution
  • From: ronaldoussoren <email@hidden>
  • Date: Mon, 31 May 2010 07:00:06 -0700 (PDT)
  • Date-warning: Date header was inserted by spool001.mac.com



On May 31, 2010, at 02:45 PM, Louis-Philippe <email@hidden> wrote:

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"

You need to add "#include <objc/runtime.h>" to the start of your implementation file.

Ronald

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >dynamic resolution (From: Louis-Philippe <email@hidden>)

  • Prev by Date: NSNetService - send data to printer
  • Next by Date: Re: UTI strings
  • Previous by thread: Re: dynamic resolution
  • Next by thread: NSNetService - send data to printer
  • Index(es):
    • Date
    • Thread