我正在iOS 11上使用AVCapturePhotoOutput构建相机应用程序。下面我使用AVCapturePhotoSettings将flashMode设置为on并将捕获的图像返回到视图。闪光灯和照片捕捉均成功运行,但在闪光灯亮起之前拍摄照片。有没有办法将闪光灯和照片捕捉同步到闪光灯亮起时拍摄的位置?
以下是我的代码:
-(void)CapturePhoto
{
photoSettings = [AVCapturePhotoSettings photoSettings];
photoSettings.flashMode = AVCaptureFlashModeOn;
[photoOutput capturePhotoWithSettings:photoSettings delegate:self];
}
-(void)captureOutput:(AVCapturePhotoOutput *) photoOutput
didFinishProcessingPhoto:(AVCapturePhoto *) photo
error:(NSError *)error
{
if (error)
{
NSLog(@"error : %@", error.localizedDescription);
}
NSData *data = photo.fileDataRepresentation;
UIImage *image = [UIImage imageWithData:data];
NSString* snapshotResponse = @"image has been outputted!";
NSLog(@"%@", snapshotResponse);
}