Type introspection with NSMethodSignature, deprecated NSObjCValueType?
Type introspection with NSMethodSignature, deprecated NSObjCValueType?
- Subject: Type introspection with NSMethodSignature, deprecated NSObjCValueType?
- From: Jim Correia <email@hidden>
- Date: Fri, 1 Feb 2008 10:25:00 -0500
I have a situation where I need to do some method introspection.
Given an arbitrary selector, and after having verified that instances
respond to the selector, I'd like to make sure the method signature
matches a particular form.
NSObjCValueType is listed as deprecated in the headers. (Documentation
says "Used internally by NSInvocation—do not use it directly.")
The documentation for -methodReturnType and -getArgumentTypeAtIndex:
on NSMethodSignature says "This encoding is implementation-specific,
so applications should use it with caution."
Suppose I want to verify that a given method signature looks like an
action method.
if ([methodSignature numberOfArguments] == 3 &&
0 == strcmp(@encode(void), [methodSignature methodReturnType]) &&
0 == strcmp(@encode(id), [methodSignature getArgumentTypeAtIndex: 2]) {
}
Is testing the argument types in this manner, with @encode(), going to
be future proof?
Thanks,
Jim_______________________________________________
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