No type or protocol error while protocol is imported
13,354
Solution 1
You should forward declare protocol in .h files before you use it. Put this in the top of BlurWorkerGPU.h
@protocol VideoWorker;
Solution 2
check whether you are importing "BlurWorkerGPU.h" in "LoadingVC.h"
Solution 3
Possible solutions are
- import protocol
@import YOURPROTOCOLNAME
- import Class in which protocol is declared
#import "YOURCLASSWHICHDECLAREDPROTOCOL.h"
- Use @Class to import the class
@class YOURCLASSWHICHDECLAREDPROTOCOL;
Comments
-
tna0y about 2 years
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?