1

I get an error: cannot find protocol declaration for 'SentencesDelegate'. However I'm importing the header where the protocol is defined. These are the 2 headers files (defining and using the protocol respectively):

SentencesViewController.h

#import <UIKit/UIKit.h> #import "SansnuageAppDelegate.h" // Define a new protocol // Best practice - make this protocol conform to the <NSObject> protocol @protocol SentencesDelegate <NSObject> // By default, methods are "required"; you can change this by prefacing methods with "@optional" - (void) setSentence:(NSString *)sentence; @end @interface SentencesViewController : UITableViewController { SansnuageAppDelegate* appDelegate; NSArray *sentencesList; } @property (nonatomic, assign) id <SentencesDelegate> delegate; @end 

ComposerViewController.h

#import <UIKit/UIKit.h> #import "SentencesViewController.h" #import "ANColorPicker.h" #import "SansnuageAppDelegate.h" @interface ComposerViewController : UIViewController <SentencesDelegate, ANColorPickerDelegate, UITableViewDelegate, UITableViewDataSource> { ANColorPicker * picker; UIView * colorView; UITableView * composerTableView; NSMutableArray *dataList; SansnuageAppDelegate* appDelegate; } @property(nonatomic, retain) UIView * colorView; @property(nonatomic, retain) IBOutlet UITableView *composerTableView; @property(nonatomic, retain) IBOutlet UIButton *previewB; @property(nonatomic, retain) IBOutlet UIButton *sendB; @end 

thanks

7
  • Did you really mean #import SansnuageAppDelegate; in the second line of your first code block? Commented Aug 22, 2011 at 14:18
  • @Yuji uhm, yeah I really meant it, I need the delegate to get the managedObjectContext Commented Aug 22, 2011 at 14:26
  • There are no quotes or braces around the second import statement in SentencesViewController.h - Is that a typo or is that really how you have it? Commented Aug 22, 2011 at 14:33
  • @onnoweb No sorry, my fault, it was a typo. I haven't solved yet. Commented Aug 22, 2011 at 14:36
  • Is that ";" there - and not a typo - in '#import "SansnuageAppDelegate.h";'? Commented Aug 22, 2011 at 14:41

1 Answer 1

2

Ok, so the solution was that I was importing #import "SentencesViewController.h" in the implementation file as well. Very stupid mistake, but the error description didn't help at all.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.