Warning: redefining protocol "..." is ignored

How do I respond to this warning?

warning: duplicate protocol definition "..." is ignored

The declaration of my protocol is in its own .h file, and it is # imported into several other files in my project.

Well, just in case, here is the entire header file with the protocol declaration:

#import <Foundation/Foundation.h> 

@class Wrapper;

@protocol WrapperDelegate

@required
- (void)wrapper:(Wrapper *)wrapper didRetrieveData:(NSData *)data;

@optional
- (void)wrapperHasBadCredentials:(Wrapper *)wrapper;
- (void)wrapper:(Wrapper *)wrapper didCreateResourceAtURL:(NSString *)url;
- (void)wrapper:(Wrapper *)wrapper didFailWithError:(NSError *)error;
- (void)wrapper:(Wrapper *)wrapper didReceiveStatusCode:(int)statusCode;

@end

Thanks for any advice.

+6
source share
4 answers

Make sure you don’t have a header file added to the project twice, or two different files that both implement the protocol. This is what caused the warning to me.

+6
source

, . Xcode. Xcode, 2 . . .

+3

, .

, . , , , , .

.

, , #import , . , #include, , ?

#import . , , , , . MyLibrary.h, , , Xcode .

, .

enter image description here

- include/$(TARGET_NAME) - .

- , MyLibrary.h. .

TL;DR: . , , , .

+1

, ,

#import

#include

.

0

All Articles