0

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?

user1120133
  • 3,244
  • 3
  • 48
  • 90

2 Answers2

2

Try to remove @protocol ModalViewDelegate; in modalviewcontroller.h and import Mainviewcontroller.h in this file.

OdNairy
  • 540
  • 4
  • 15
1

You are defining the protocol twice one in mainviewcontroller.h and the other in modalViewController.h...thats why you are getting the warning...

Daniel
  • 22,363
  • 9
  • 64
  • 71
  • Do you sure that syntax `@protocol … ;` is definition? I think it pre-definition and it says for linker - "You will find this protocol later, man". – OdNairy Jan 17 '12 at 22:10