Cannot find protocol definition for XXX

objective-c, protocols

Solution

I always do it this way:

@class LeveyPopListView;

@protocol LeveyPopListViewDelegate <NSObject>
//the definition for LeveyPopListViewDelegate
@end

@interface LeveyPopListView : UIView <LeveyPopListViewDelegate,UITableViewDataSource,   UITableViewDelegate,UITextFieldDelegate>

//the content of LeveyPopListView

@end

Problem

I have declared a protocol firstly, and then use it. But I get a warning "Cannot find protocol definition for LeveyPopListViewDelegate". Here is the code: ``` @protocol LeveyPopListViewDelegate; @interface LeveyPopListView : UIView <LeveyPopListViewDelegate,UITableViewDataSource, UITableViewDelegate,UITextFieldDelegate> //the content of LeveyPopListView @end @protocol LeveyPopListViewDelegate <NSObject> //the definition for LeveyPopListViewDelegate @end ``` if I put the definition `LeveyPopListViewDelegate` at first, I can not use the `LeveyPopListView` in the protocol.

Original source