问题
Getting warning message that Duplicate protocol definition of ModalViewDelegate is ignored
Defined protocol in modalviewcontroller.h file
@protocol ModalViewDelegate;
-(void)dismissView:(id)sender;
@interface Modalviewcontroller : UIViewController
{
id<ModalViewDelegate>delegate;
}
@property (nonatomic, assign) id<ModalViewDelegate>delegate;
@end
In the Modalviewcontroller.m file synthesize delegate
In Mainviewcontroller.h file
@protocol ModalViewDelegate
-(void)didDismissModal:(id)sender;
@end
@interface Mainviewcontrollerontroller : UIViewController <ModalViewDelegate>
-(void)showModal:(id)sender;
In the Mainviewcontroller.m not synthesize delegate
Am I supposed to delegate in mainviewcontroller.m file too?
Why I'm getting warning message of duplicate protocol definition?
回答1:
Try to remove @protocol ModalViewDelegate;
in modalviewcontroller.h
and import Mainviewcontroller.h
in this file.
回答2:
You are defining the protocol twice one in mainviewcontroller.h and the other in modalViewController.h...thats why you are getting the warning...
来源:https://stackoverflow.com/questions/8901352/duplicate-protocol-definition