• 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
Type introspection with NSMethodSignature, deprecated NSObjCValueType?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Type introspection with NSMethodSignature, deprecated NSObjCValueType?
      • From: Benjamin Stiglitz <email@hidden>
    • Re: Type introspection with NSMethodSignature, deprecated NSObjCValueType?
      • From: glenn andreas <email@hidden>
  • Prev by Date: Re: How does NSButtonCell do its drawing?
  • Next by Date: Standard Permissions and/or ACLs in OS X
  • Previous by thread: Re: NSPopUpButtonCell always select first item
  • Next by thread: Re: Type introspection with NSMethodSignature, deprecated NSObjCValueType?
  • Index(es):
    • Date
    • Thread