【问题标题】:Value of type 'AVCapturePhotoOutput' has no member 'outputSettings''AVCapturePhotoOutput' 类型的值没有成员 'outputSettings'
【发布时间】:2017-10-09 07:43:39
【问题描述】:

很好奇,这在 Swift 4 中会是什么? stimageout = AVCapturePhotoOutput() stimageout?.outputSettings = [AVVideoCodecKey : AVVideoCodecJPEG]

目前,Value of type 'AVCapturePhotoOutput' has no member 'outputSettings' 出现错误,这很奇怪,因为我不记得 Apple 会更改它。

这不是“求救”式的问题。我只是好奇Apple是否改变了这一点以及我需要采取哪些步骤来解决这个问题。

提前致谢。 :)

【问题讨论】:

    标签: swift ios11 swift4


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2021-01-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-07
      • 2016-03-11
      • 1970-01-01
      • 1970-01-01
      • 2021-06-17
      相关资源
      最近更新 更多