Maxim Maxim - 1 year ago 357
iOS Question

No type or protocol error while protocol is imported

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

@protocol VideoWorker <NSObject>


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



@interface LoadingVC : UIViewController <UIAlertViewDelegate>

then in BlurWorkerGPU.h

#import "LoadingVC.h"

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

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?

lcl lcl
Answer Source

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

@protocol VideoWorker;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download