Difference between SEL and const char* when sending a message?
Difference between SEL and const char* when sending a message?
- Subject: Difference between SEL and const char* when sending a message?
- From: Daqi Pei <email@hidden>
- Date: Wed, 8 Apr 2009 11:34:32 +0800
Hi everyone. I'm new to Objective-C but I've been working with C++ for
years. I'm trying to understand how the selector mechanism works.
So far it seems to me that SEL is simply a wrapper for 'const char*', Obj-C
compiler maintains a table of all method name - method function pointer
pairs and pick up one according to the object you passed to the call. (Sorry
for my C++ semasiology)
My hypothesis works well with method calls with no parameters. e.g. , you
cal write:
[myObj performSelector: (SEL)"someMethod"];
Though when it comes to method with parameters, it looks like a total
different story.
NSSelectorFromString(); works fine, but the approach above throws
exceptions.
Anyone knows why? Thanks.
Regards,
DairyKnight
_______________________________________________
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