• 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
Re: respondsToSelector & "warning: may not respond"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: respondsToSelector & "warning: may not respond"


  • Subject: Re: respondsToSelector & "warning: may not respond"
  • From: Mike Abdullah <email@hidden>
  • Date: Fri, 26 Nov 2010 18:27:07 +0000

You have many options, in rough order of cleanness:

A) Declare a protocol that your objects conform to. Make -setOrdinal: @optional

B) Do [object performSelector:@selector(setOrdinal:) withObject:value] or use -setValue:forKey:

C) Typecast the object to a class that is known to implement -setOrdinal:

On 26 Nov 2010, at 17:47, Mikkel Eide Eriksen wrote:

> I should have mentioned that it is declared, but obj can be one of many classes only some of which have setOrdinal:
>
> On Nov 26, 2010, at 6:46 PM, banane wrote:
>
>> declare the method in your header file. "-(void)setOrdinal;"
>>
>> On Fri, Nov 26, 2010 at 9:08 AM, Mikkel Eide Eriksen <email@hidden> wrote:
>> Hi all,
>>
>> I have the following bit in my code:
>>
>> if ([obj respondsToSelector:@selector(setOrdinal:)]) {
>>       [obj setOrdinal:value];
>> }
>>
>> XCode gives a warning that obj may not respond to setOrdinal: which won't be a problem unless something is really screwy. But how do I get rid of the warning? Or do I just live with it?
>>
>> Regards,
>> Mikkel
>> _______________________________________________
>>
>> 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
>>
>
> _______________________________________________
>
> 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

_______________________________________________

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: respondsToSelector & "warning: may not respond"
      • From: Dave Zwerdling <email@hidden>
    • Re: respondsToSelector & "warning: may not respond"
      • From: Ken Thomases <email@hidden>
References: 
 >respondsToSelector & "warning: may not respond" (From: Mikkel Eide Eriksen <email@hidden>)
 >Re: respondsToSelector & "warning: may not respond" (From: Mikkel Eide Eriksen <email@hidden>)

  • Prev by Date: Re: respondsToSelector & "warning: may not respond"
  • Next by Date: Re: respondsToSelector & "warning: may not respond"
  • Previous by thread: Re: respondsToSelector & "warning: may not respond"
  • Next by thread: Re: respondsToSelector & "warning: may not respond"
  • Index(es):
    • Date
    • Thread