Luuk D. Jansen
Luuk D. Jansen

Reputation: 4496

Protocol definition not found

I am having a little trouble with getting a protocol definition to work, and this must be a stupid mistake. I included the header in which the definition is located, but I got the warning, so followed the advice to create a separate header file. I still get the warning that the definition cannot be found (when importing this separate file), and even when I put the definition in the header file of the class using it it gives the warning:

@protocol SubstitutableDetailViewController <NSObject>
- (void)showRootPopoverButtonItem:(UIBarButtonItem *)barButtonItem;
- (void)invalidateRootPopoverButtonItem:(UIBarButtonItem *)barButtonItem;
@end

@interface LauncherViewController :TTViewController<SubstitutableDetailViewController, TTLauncherViewDelegate> {
    TTLauncherView *launcherView;
}

So what do I do wrong in my definition of the protocol?

[EDIT: Sorry, there must be an oddity in Xcode, or I am going mad, I did a clean build and now the warning does not come back... but I don't know why]

Upvotes: 1

Views: 589

Answers (1)

Ruben Marin
Ruben Marin

Reputation: 1637

Put this code in a separate file named SubstitutableDetailViewController.h (I'd prefer SubstitutableDetailViewControllerDelegate.h):

@protocol SubstitutableDetailViewController <NSObject> - (void)showRootPopoverButtonItem:(UIBarButtonItem *)barButtonItem; - (void)invalidateRootPopoverButtonItem:(UIBarButtonItem *)barButtonItem; @end

And then include it in LauncherViewController via #import "SubstitutableDetailViewController.h"

Upvotes: 2

Related Questions