I have declared a protocol firstly, and then use it. But I get a warning "Cannot find protocol definition for LeveyPopListViewDelegate". Here is the code:
@protocol LeveyPopListViewDelegate;
@interface LeveyPopListView : UIView <LeveyPopListViewDelegate,UITableViewDataSource, UITableViewDelegate,UITextFieldDelegate>
//the content of LeveyPopListView
@end
@protocol LeveyPopListViewDelegate <NSObject>
//the definition for LeveyPopListViewDelegate
@end
if I put the definition LeveyPopListViewDelegate
at first, I can not use the LeveyPopListView
in the protocol.
I ended up suppressing all warnings for that particular line, which is not ideal but works well.
// Forward-declare protocols (to avoid circular inclusion)
@protocol YourProtocol;
#pragma clang diagnostic push
// To get rid of 'No protocol definition found' warnings which are not accurate
#pragma clang diagnostic ignored "-Weverything"
@interface YourClass: NSObject
// <YourProtocol>
#pragma clang diagnostic pop
Make sure you do push & pop, otherwise you'll end up with all warnings being ignored for this file!
If you followed the good advice in this post and still have the issue try just doing a clean. I was scratching my head over it for a while and a clean resolved the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With