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

7

好奇,这在Swift 4中会是什么样子呢?

stimageout = AVCapturePhotoOutput() stimageout?.outputSettings = [AVVideoCodecKey : AVVideoCodecJPEG]

目前,它会出现错误 Value of type 'AVCapturePhotoOutput' has no member 'outputSettings' ,这很奇怪,因为我没有记忆苹果更改过这个。

这不是“求助”类型的问题。 我只是好奇苹果是否更改了此内容以及修复此问题需要进行哪些步骤。

先行致谢。:)

1个回答

11

问题是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)

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


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接