'AVCapturePhotoOutput' 类型的值没有成员 'outputSettings'
Value of type 'AVCapturePhotoOutput' has no member 'outputSettings'
很好奇,Swift 4 中会出现什么?
stimageout = AVCapturePhotoOutput()
stimageout?.outputSettings = [AVVideoCodecKey : AVVideoCodecJPEG]
目前,Value of type 'AVCapturePhotoOutput' has no member 'outputSettings'
出错,这很奇怪,因为我不记得 Apple 对此进行了更改。
这不是"begging for help"类型的问题。我只是好奇 Apple 是否更改了此设置以及我需要执行的步骤来解决此问题。
提前致谢。 :)
问题是 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
很好奇,Swift 4 中会出现什么?
stimageout = AVCapturePhotoOutput()
stimageout?.outputSettings = [AVVideoCodecKey : AVVideoCodecJPEG]
目前,Value of type 'AVCapturePhotoOutput' has no member 'outputSettings'
出错,这很奇怪,因为我不记得 Apple 对此进行了更改。
这不是"begging for help"类型的问题。我只是好奇 Apple 是否更改了此设置以及我需要执行的步骤来解决此问题。
提前致谢。 :)
问题是 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