类型“ AVCapturePhotoOutput”的值没有成员“ outputSettings”

San*_*jay 2 swift swift4 ios11

很好奇,在Swift 4中会是什么? stimageout = AVCapturePhotoOutput() stimageout?.outputSettings = [AVVideoCodecKey : AVVideoCodecJPEG]

目前,它的错误Value of type 'AVCapturePhotoOutput' has no member 'outputSettings'是很奇怪的,因为我没有记着苹果更改它的记录。

这不是“乞求帮助”类型的问题。我很好奇Apple是否更改了此设置以及我需要采取的步骤来解决此问题。

提前致谢。:)

nat*_*ter 5

问题是outputSettings财产而AVCaptureStillImageOutput不是财产AVCapturePhotoOutput

AVCaptureStillImageOutput在iOS 10中已弃用,因此对于iOS 10+,请AVCapturePhotoOutput改用。要使用新的API设置设置,可以使用AVCapturePhotoSettings对象。

let stimageout = AVCapturePhotoOutput()
let settings = AVCapturePhotoSettings()
settings.livePhotoVideoCodecType = .jpeg
stimageout.capturePhoto(with: settings, delegate: self)
Run Code Online (Sandbox Code Playgroud)

Apple的AVCapturePhotoOutput文档:https//developer.apple.com/documentation/avfoundation/avcapturephotooutput