作者:什锦平 | 来源:互联网 | 2023-01-13 21:37
很好奇,在Swift 4中会是什么?
stimageout = AVCapturePhotoOutput()
stimageout?.outputSettings = [AVVideoCodecKey : AVVideoCodecJPEG]
目前,它的错误Value of type 'AVCapturePhotoOutput' has no member 'outputSettings'
是很奇怪的,因为我没有记着苹果更改它的记录。
这不是“乞求帮助”类型的问题。我很好奇Apple是否更改了此设置以及我需要采取的步骤来解决此问题。
提前致谢。:)
1> nathangitter..:
问题是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)
Apple的AVCapturePhotoOutput
文档:https://developer.apple.com/documentation/avfoundation/avcapturephotooutput