1

我正在 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);
 }
4

0 回答 0