• 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: Xcode warns about missing protocol definition, even though @protocol is used
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Xcode warns about missing protocol definition, even though @protocol is used


  • Subject: Re: Xcode warns about missing protocol definition, even though @protocol is used
  • From: Kyle Sluder <email@hidden>
  • Date: Thu, 03 May 2012 15:13:17 -0700

On May 3, 2012, at 3:08 PM, Marco S Hyman wrote:

>> I just tried this, and it gives me a warning:
>
> That is what he's complaining about... the warning.

Except he just said he got it to compile without a warning, which means that whatever he's got going on is more complicated than the situation as Uli and I have understood it.

>
> To the OP: there is no way a compiler can tell if a class conforms
> to a protocol when the only thing it knows is the name of the
> protocol.  Thus the warning.  Maybe it will compile and run...
> maybe not.

Except the compiler produces the warning on the @interface, which provides no information about whether the class actually implements the required protocol methods. You don't need to redeclare methods from protocols you adopt. The logical place to emit this warning is on the @implementation, so the compiler can alert you that it can't verify you've _implemented_ all the methods you claim to.

But even that's not good enough, because it would make it impossible to implement a proxy class that claims to conform to a protocol but actually forwards the messages to the object it's proxying via -forwardingTargetForSelector:, without getting warnings that the class hasn't implemented the protocol methods.

--Kyle Sluder
_______________________________________________

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: Xcode warns about missing protocol definition, even though @protocol is used
      • From: Quincey Morris <email@hidden>
References: 
 >Re: Xcode warns about missing protocol definition, even though @protocol is used (From: Florian Pilz <email@hidden>)
 >Re: Xcode warns about missing protocol definition, even though @protocol is used (From: Kyle Sluder <email@hidden>)
 >Re: Xcode warns about missing protocol definition, even though @protocol is used (From: Marco S Hyman <email@hidden>)

  • Prev by Date: Re: Xcode warns about missing protocol definition, even though @protocol is used
  • Next by Date: Re: how to prevent TableView update on key repeat?
  • Previous by thread: Re: Xcode warns about missing protocol definition, even though @protocol is used
  • Next by thread: Re: Xcode warns about missing protocol definition, even though @protocol is used
  • Index(es):
    • Date
    • Thread