Pragma ignore missing protocol definition

Dear Apple,


Is there a clang diagnostic ignore for the warning "Cannot find protocol definition for <...>"?


While I cannot make the definition available in the header, every file importing this header will also import the definition. In which case, the code will run correctly (right?)

Replies

This also happens when having a Swift protocol and using it in Objective-C.


More information can be found on StackOverflow. But the warning shows up and it'd be great if there was a way to ignore it.

It's been a year and this is still the thing. I'm also pretty disappointed that there isn't even a way to ignore those warnings if we can't do anything about them.

Warnings for missing protocol definitions or incomplete conformance can be suppressed for a single line with

// To get rid of 'Class does not conform to protocol' warnings
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wprotocol" 
@interface YourClass: NSObject<YourProtocol>
#pragma clang diagnostic pop
// To get rid of 'cannot find protocol definition for' warnings
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wprotocol" 
@property id<YourProtocol> yourProperty
#pragma clang diagnostic pop