首先,在LoadingVC.h中,我声明了一个协议:
@protocol VideoWorker <NSObject> @required @property (nonatomic) float progress; @property (nonatomic) BOOL done; -(void)beginWorking; @end @interface LoadingVC : UIViewController <UIAlertViewDelegate> ... @end
然后在BlurWorkerGPU.h中
...
#import "LoadingVC.h"
@interface BlurWorkerGPU : NSObject <VideoWorker> {
...
}
- (void)beginWorking;
@property(nonatomic)float progress;
@property(nonatomic)BOOL done;
...
@end
然而,llvm说
“No type or protocol named ‘VideoWorker'”
这很奇怪,因为我正在导入定义协议的标头.有线索吗?
解决方法
在使用之前,您应该在.h文件中转发声明协议.把它放在BlurWorkerGPU.h的顶部
@protocol VideoWorker;