2017-10-08 98 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

相關問題