Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Value of type 'AVCapturePhotoOutput' has no member 'outputSettings'

Curious, what would this be in Swift 4? stimageout = AVCapturePhotoOutput() stimageout?.outputSettings = [AVVideoCodecKey : AVVideoCodecJPEG]

Currently, it errors with Value of type 'AVCapturePhotoOutput' has no member 'outputSettings' which is odd since I don't have memory of Apple changing this.

This is not "begging for help"-type question. I'm just curious if Apple changed this and the steps I need to do in order to fix this issue.

Thanks in advance. :)

like image 775
Sanjay Avatar asked Oct 08 '17 22:10

Sanjay


1 Answers

The problem is outputSettings is a property on AVCaptureStillImageOutput, not AVCapturePhotoOutput.

AVCaptureStillImageOutput is deprecated in iOS 10, so for iOS 10+, use AVCapturePhotoOutput instead. To set settings using the new API, you can use an AVCapturePhotoSettings object.

let stimageout = AVCapturePhotoOutput()
let settings = AVCapturePhotoSettings()
settings.livePhotoVideoCodecType = .jpeg
stimageout.capturePhoto(with: settings, delegate: self)

Apple's AVCapturePhotoOutput Documentation: https://developer.apple.com/documentation/avfoundation/avcapturephotooutput

like image 95
nathangitter Avatar answered Nov 17 '22 03:11

nathangitter