• 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: compiler warning for not fully implementing protocol
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: compiler warning for not fully implementing protocol


  • Subject: Re: compiler warning for not fully implementing protocol
  • From: Mark Sanvitale <email@hidden>
  • Date: Thu, 31 Jul 2008 16:14:16 -0700

I think I am doing exactly what you say is necessary (i.e. declare the second method in the superclass's public interface).

Here are some code snippets:

PortalTabView is the super class (which happens to also adopt a protocol, which is not part of this issue but including it for completeness):

@protocol PortalTabProtocol
- (void)refreshDisplay:(XBCapture *)capture because:(XBRefreshCause) trigger;
@end


@interface PortalTabView : NSView <PortalTabProtocol>
{}
- (NSString *)tabName;
- (void)refreshDisplay:(XBCapture *)capture because:(XBRefreshCause) trigger;
- (XBCapture *)displayCapture;
@end


PortalActionView is the class that gets the compiler warnings about the ReadArchiveClient protocol:

@protocol ReadArchiveClient
- (XBCapture *)displayCapture;
- (void)processedArchive:(WebArchive *)archive;
@end

@interface PortalActionView : PortalTabView <ReadArchiveClient>


So, PortalActionView does implement processedArchive: (without declaring it in its interface) but the displayCapture method is coming from its super class which does declare this method in its public interface, yet the compiler complains "method definition for '- displayCapture' not found". Complier bug?



On Jul 31, 2008, at 1:13 PM, Bill Bumgarner wrote:

On Jul 31, 2008, at 11:36 AM, Mark Sanvitale wrote:
I have a formal protocol that declares two methods. I have a class that adopts this protocol. This class implements one of the protocol methods. This class inherits from another class. This super class actually implements a method matching the signature of the second method declared in the protocol. Everything runs just fine, however, the compiler insists something is wrong by warning me "incomplete implementation of class X", "method definition for '<method-name>' not found", and class 'X' does not fully implement the 'Y' protocol".

I think the compiler is wrong. Or is this "by design" according to some strict rule(s) of Objective-C? Am I expected to redefine the method I inherit from my super class if the method is part of a protocol I adopt?

The compiler has no way of knowing that the protocol's contract was fulfilled by the superclass unless you also declare the second method in the superclass's public interface.


If you don't want to expose the method's declaration, declare it in a private header.

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


  • Follow-Ups:
    • Re: compiler warning for not fully implementing protocol
      • From: "Adam R. Maxwell" <email@hidden>
    • Re: compiler warning for not fully implementing protocol
      • From: "Kyle Sluder" <email@hidden>
References: 
 >compiler warning for not fully implementing protocol (From: Mark Sanvitale <email@hidden>)
 >Re: compiler warning for not fully implementing protocol (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: Re: Thread safety with background fetching
  • Next by Date: Re: Thread safety with background fetching
  • Previous by thread: Re: compiler warning for not fully implementing protocol
  • Next by thread: Re: compiler warning for not fully implementing protocol
  • Index(es):
    • Date
    • Thread