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
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.