On Aug 18, 2008, at 11:17 AM, Carmen Cerino Jr. wrote:

Does the id type have enough information for the respondsToSelector method to work. I have a class with an ivar of type id, and when I invoke the respondsToSelector method it fails when it should succeed. I am assuming it should work fine, because if I skip checking with the respondsToSelector method and just make the call, it executes the method. Can someone please tell me what I am doing wrong?

What code are you using with -respondsToSelector: and to invoke the selector?

We need to see that in order to be able to say whether what you're doing will work.

On background: -respondsToSelector: is a message like any other message in Objective-C. It's not an operation on a type; you're actually sending a message to the object in question, which will use the Objective-C runtime to answer the question that's asked. So the static type of the variable referencing the object it's sent to -- in your case, "id" -- doesn't have anything to do with how the actual message behaves.

  -- Chris

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to