找不到协议声明,但我实际上正在导入它

时间:2011-08-22 14:13:42

标签: objective-c ios

我收到错误:找不到'SentencesDelegate'的协议声明。 但是我正在导入定义协议的标头。 这些是2个头文件(分别定义和使用协议):

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

感谢

1 个答案:

答案 0 :(得分:2)

好的,所以解决方法是我导入#import“SentencesViewController.h”  在实现文件中也是如此。非常愚蠢的错误,但错误描述根本没有帮助。