On Sep 8, 2009, at 3:25 PM, Brent Gulanowski wrote:
For selectors, you can check whether NSSelectorFromString(@"selector")
returns a selector.

That won't do what you want. NSSelectorFromString() always returns a selector; it creates one itself if that name has not been used yet. (And "not used yet" differs from "does not exist" anyway; the runtime manipulates selectors as lazily as it can.)

Try these instead:
[NSClassFromString(@"SomeClass") respondsToSelector:@selector (someClassMethod)]; [NSClassFromString(@"SomeClass") instancesRespondToSelector:@selector(someInstanceMethod)];


--
Greg Parker     gpar...@apple.com     Runtime Wrangler


_______________________________________________

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