拍摄照片时使用AVCapturePhotoOutput拍摄重量闪光问题

Dha*_*tel 5 ios avcapturesession swift avcapturephotosettings

我正在开发相机应用程序.我正在为ios 10.x设备使用AVCapturePhotoOutput,为10.x设备使用AVCaptureStillImageOutput.

捕获照片时,我正在使用捕获设置下方

let settings = AVCapturePhotoSettings()

let previewPixelType = settings.availablePreviewPhotoPixelFormatTypes.first!
        let previewFormat = [kCVPixelBufferPixelFormatTypeKey as String: previewPixelType,
                             kCVPixelBufferWidthKey as String: 1080,
                             kCVPixelBufferHeightKey as String: 1080,
                             ]
settings.previewPhotoFormat = previewFormat
settings.isHighResolutionPhotoEnabled = true
settings.flashMode = .on
settings.isAutoStillImageStabilizationEnabled = true
self.captureOutputPhoto?.capturePhoto(with: settings, delegate: self)
Run Code Online (Sandbox Code Playgroud)

当我尝试使用上述设置拍摄照片时

captureOutput:didFinishProcessingPhotoSampleBuffer:previewPhotoSampleBuffer:resolvedSettings:bracketSettings:error
Run Code Online (Sandbox Code Playgroud)

上面的委托第一次抛出错误.我是AVCapturePhotoSettings的初学者.每次使用闪光模式成功拍摄照片后都会出现此问题.

And*_*nov -1

来自苹果文档

如果闪光灯模式打开,您可能无法启用图像稳定功能。(启用闪光灯优先于 isAutoStillImageStabilizationEnabled 设置。)

不确定,是否会引发错误,但您可以尝试删除此字符串

settings.isAutoStillImageStabilizationEnabled = true
Run Code Online (Sandbox Code Playgroud)