0
votes

I have declared a protocol, everything seems to work fine, even Xcode auto-complete the name of the protocol if I try to adopt it, but when I compile the project it keeps telling me "Cannot Find Protocol Declaration". It's strange because is the second protocol I adopt in the same class and I dont have any error with the former! Here is the code:

Here I declare the protocol:

//  LoginViewController.h
#import <UIKit/UIKit.h>

@protocol LoginEndDelegate <NSObject>

 -(void)doneLogin;


@end

And here I try to adopt it:

#import "LoginViewController.h"
#import "WebServiceAPI.h"

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


@interface RootViewController : UITableViewController   <UISplitViewControllerDelegate,WebServiceAPIDelegate,LoginEndDelegate> {

Please help me out guys.. Thank you!

1

1 Answers

0
votes

Try preprocessing the source file that imports your second code snippet and make sure the declaration for LoginEndDate appears before the interface declaration. (the product menu has a "Generate Preprocesssed file" item under "Generate Output" on XCode 4).

Most likely you have an import dependency cycle. LoginViewController.h possibly imports something that causes the interface declaration to be imported ahead of the protocol declaration.