• 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 - #import OR compiler warnings?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: respondsToSelector - #import OR compiler warnings?


  • Subject: Re: respondsToSelector - #import OR compiler warnings?
  • From: Bill Bumgarner <email@hidden>
  • Date: Tue, 30 Dec 2008 16:03:32 -0800

On Dec 30, 2008, at 3:51 PM, mmalc crawford wrote:
I hope Bill will forgive me adding another option.

With this pattern, it's also common for your protocol to adopt another protocol, such as NSObject:

@MyProtocol <NSObject>
@optional
- (void)myMethod;
@end

This way you can test your delegate using respondsToSelector: without the compiler complaining.

No, no, Malcolm. I will not forgive you. Not at all. You owe me for THAT one...


Back here in reality, Mmalc is absolutely right. You can either add <NSObject> as he suggests, or declare that your delegates are subclasses of NSObject (which does the same in a roundabout way):

NSObject<BobsYourDelegateProtocol> *myBob;

b.bum

_______________________________________________

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


References: 
 >respondsToSelector - #import OR compiler warnings? (From: Steve Cronin <email@hidden>)
 >Re: respondsToSelector - #import OR compiler warnings? (From: Graham Cox <email@hidden>)
 >Re: respondsToSelector - #import OR compiler warnings? (From: Steve Cronin <email@hidden>)
 >Re: respondsToSelector - #import OR compiler warnings? (From: Steve Cronin <email@hidden>)
 >Re: respondsToSelector - #import OR compiler warnings? (From: Bill Bumgarner <email@hidden>)
 >Re: respondsToSelector - #import OR compiler warnings? (From: Bill Bumgarner <email@hidden>)
 >Re: respondsToSelector - #import OR compiler warnings? (From: mmalc crawford <email@hidden>)

  • Prev by Date: Re: respondsToSelector - #import OR compiler warnings?
  • Next by Date: Re: Saving unseen NSView with subviews to NSImage
  • Previous by thread: Re: respondsToSelector - #import OR compiler warnings?
  • Next by thread: Re: respondsToSelector - #import OR compiler warnings?
  • Index(es):
    • Date
    • Thread