简体   繁体   中英

Cannot find protocol declaration for ' '

I know this question has been asked a lot, but it doesn't help me...

I have made a lot of delegate protocol in my projects, but this happened a lot...

I got an error cannot find protocol declaration for ''. The weird thing is that when i do this for the first time :

   id<dataForEventDelegate> dataEventDelegate;

It works, i build, i try a rebuild and PAF doesn't find the protocole anymore...

my code looks like that in my delegate .H :

@protocol dataForEventDelegate <NSObject>

-(void)setStartDateLabel:(NSDate *)startDaleLabel;
-(void)setEndDateLabel:(NSDate *)endDaleLabel;
-(void)setDefaultCalendarLabel;

@end

@interface EventViewController : UIViewController <UITextFieldDelegate, UIPickerViewDelegate, dataForEventDelegate>

this is in my file.h which should use the delegate

#import "EventViewController.h"

@interface datePickerController : UIPickerView <UIPickerViewDelegate, UIPickerViewDataSource>
{
   id<dataForEventDelegate> dataEventDelegate;

    NSMutableArray *dateArray;
}

@property(nonatomic, strong) id<dataForEventDelegate> dataEventDelegate;

this dataForEventDelegate is not found !! BUT IT SHOULD :(

It seems you have not made datePickerController conform to the protocol, should be:

@interface datePickerController : NSObject <UIPickerViewDelegate, UIPickerViewDataSource, dataForEventDelegate>

I would also question why you are declaring datePickerController as a UIPickerView. See My example is NSObject.

I am also not sure why you would want EventViewController to conform to its own protocol. See it removed here:

@interface EventViewController : UIViewController <UITextFieldDelegate, UIPickerViewDelegate>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM