简体   繁体   English

找不到“”的协议声明

[英]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... 它可以工作,我可以构建,可以尝试重新构建,而PAF不再找到该协议...

my code looks like that in my delegate .H : 我的代码在我的委托.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 这是在我的file.h中,应该使用委托

#import "EventViewController.h"

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

    NSMutableArray *dateArray;
}

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

this dataForEventDelegate is not found !! 找不到此dataForEventDelegate !! BUT IT SHOULD :( 但应该:(

It seems you have not made datePickerController conform to the protocol, should be: 似乎您尚未使datePickerController符合协议,应为:

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

I would also question why you are declaring datePickerController as a UIPickerView. 我还要问为什么您将datePickerController声明为UIPickerView。 See My example is NSObject. 请参阅我的示例是NSObject。

I am also not sure why you would want EventViewController to conform to its own protocol. 我也不确定为什么要让EventViewController遵循其自己的协议。 See it removed here: 看到它在这里删除:

@interface EventViewController : UIViewController <UITextFieldDelegate, UIPickerViewDelegate>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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