Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No type or protocol error while protocol is imported

At first, in LoadingVC.h I declare a protocol:

@protocol VideoWorker <NSObject>

@required

@property (nonatomic) float progress;
@property (nonatomic) BOOL done;

-(void)beginWorking;

@end

@interface LoadingVC : UIViewController <UIAlertViewDelegate>
...
@end

then in BlurWorkerGPU.h

...
#import "LoadingVC.h"

@interface BlurWorkerGPU  : NSObject <VideoWorker> {
...
}
- (void)beginWorking;
@property(nonatomic)float progress;
@property(nonatomic)BOOL done;
 ...
@end

However, llvm says that

"No type or protocol named 'VideoWorker'"

which is strange since I am importing the header where the protocol is defined. Any clues?

like image 666
tna0y Avatar asked Feb 26 '16 17:02

tna0y


1 Answers

You should forward declare protocol in .h files before you use it. Put this in the top of BlurWorkerGPU.h

@protocol VideoWorker;
like image 139
lcl Avatar answered Sep 25 '22 21:09

lcl