Re: Xcode warns about missing protocol definition, even though @protocol is used
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: Florian Pilz <email@hidden>
- Date: Mon, 16 Apr 2012 23:03:47 +0200
The import is done in the ".m"-file of HomeTableViewController. But I just found a fault in my sample code anyways: the ".h"-file of HomeTableViewController should have an "@protocol NewFooController" declaration.
Corrected sample code for HomeTableViewController.h:
#import <UIKit/UIKit.h>
@protocol NewFooControllerDelegate;
// warning points to line below
@interface HomeTableViewController : UITableViewController <NewFooControllerDelegate>
@end
On Saturday, 14 April 2012 at 19:00, Kyle Sluder wrote:
> On Apr 14, 2012, at 5:55 AM, Florian Pilz wrote:
>
> > NewFooController.h:
> > #import <UIKit/UIKit.h>
> > @protocol NewFooControllerDelegate;
> > @interface NewFooController : UITableViewController
> > @property (nonatomic, weak) id<NewFooControllerDelegate> delegate;
> > @end
> >
> > @protocol NewFooControllerDelegate
> > @end
> >
> > HomeTableViewController.h:
> > #import <UIKit/UIKit.h>
> > // warning points to line below
> > @interface HomeTableViewController : UITableViewController <NewFooControllerDelegate>
> > @end
> >
>
>
>
> You never imported NewFooController.h here, so when the compiler is compiling something that imported HomeTableViewController.h, it can't find the @protocol definition.
>
> --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