FlashHelper.m:
#import "FlashHelper.h"
AVCaptureDevice* inputDevice;
@interface FlashHelper ()
@end
@implementation FlashHelper
-(id)init : (AVCaptureDevice*) device{
self = [super init];
inputDevice = device;
return self;
}
-(void)turnOffFlash{
[inputDevice lockForConfiguration:nil];
[inputDevice setTorchMode:AVCaptureTorchModeOff];//turn on flash and test
[inputDevice unlockForConfiguration];
}
-(void)turnOnFlash{
[inputDevice lockForConfiguration:nil];
[inputDevice setTorchMode:AVCaptureTorchModeOn];//turn on flash and test
[inputDevice unlockForConfiguration];
}
@end
FlashHelper.h:
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
@interface FlashHelper : NSObject {
}
-(id)init : (AVCaptureDevice*) device;
-(void)turnOffFlash;
-(void)turnOnFlash;
@end
我想将此作为帮助类添加到我当前的iOS项目中。我一直收到以下错误
我对Objective-C相当新,任何帮助都会非常感激!