0
votes

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 :(

1
I think you have declared dataForEventDelegate as private in you appDelegate.h - Anoop Vaidya
Sidenote: please capitalize the first letter of protocol and class names. - user529758
Exactly in which file are you declaring the protocol? - Yunus Nedim Mehel

1 Answers

0
votes

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>