2017-10-08 173 views
1

好奇,Swift 4会是什么? stimageout = AVCapturePhotoOutput() stimageout?.outputSettings = [AVVideoCodecKey : AVVideoCodecJPEG] 类型'AVCapturePhotoOutput'的值没有成员'outputSettings'

目前,它与Value of type 'AVCapturePhotoOutput' has no member 'outputSettings'这是奇怪的错误,因为我没有苹果改变这种记忆。

这不是“求助”式的问题。我只是好奇,如果苹果改变了这一点,我需要做的步骤,以解决这个问题。

在此先感谢。 :)

回答

2

问题是outputSettingsAVCaptureStillImageOutput而不是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

+1

谢谢。我现在对此有了更清楚的了解。 – Sanjay

相关问题