Re: NSMethodSignature - how?
Re: NSMethodSignature - how?
- Subject: Re: NSMethodSignature - how?
- From: "Timothy J. Wood" <email@hidden>
- Date: Sat, 13 Apr 2002 12:52:46 -0700
One easy way to do this should be:
Protocol *protocol = @protocol(MyProtocol);
struct objc_method_description *methodDescription;
NSMethodSignature *signature;
methodDescription = [protocol descriptionForInstanceMethod: selector];
signature = [NSMethodSignature signatureWithObjCTypes:
methodDescription->types];
Unfortunately, +[NSMethodSignature signatureWithObjCTypes:] seems to
be a private method for some silly reason.
You could do this with public API by using NSProtocolChecker (which is
an NSProxy):
NSProtocolChecker *checker;
NSMethodSignature *signature;
checker = [[NSProtocolChecker initWithTarget: targetObject protocol:
@protocol(MyProtocol)];
signature = [checker methodSignatureForSelector: selector];
-tim
On Saturday, April 13, 2002, at 12:34 PM, Jonathan Wight wrote:
I'm writing what is basically a proxy to another object and I need to
override the object's methodSignatureForSelector method. Unfortunately I
can't get the method signature because the method doesn't actually
exist -
I'll be extracting data from the NSInvocation to generate the function
call.
Is there someway I can get a NSMethodSignature from a protocol (much
like
I'd imagine NSRemoteProxy might do it)...
Jon.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.