【问题标题】:AvCapture error after upgrading Xcode 8 to XCode 9将 Xcode 8 升级到 XCode 9 后出现 AvCapture 错误
【发布时间】:2017-12-29 14:08:49
【问题描述】:

我正在处理另一个开发人员的代码,它是一个相机应用程序。在我升级到 xCode 9 之前,我一直在研究它,它运行良好。下面是代码 sn-p

@objc protocol AVCapturePhotoOutputType {
@available(iOS 10.0, *)
var isLensStabilizationDuringBracketedCaptureSupported: Bool {get}
@available(iOS 10.0, *)
var availableRawPhotoPixelFormatTypes: [Int] {get}
@available(iOS 10.0, *)
var isHighResolutionCaptureEnabled: Bool {get 
@objc(setHighResolutionCaptureEnabled:) set}
@available(iOS 10.0, *)
var supportedFlashModes: [Int] {get}
@available(iOS 10.0, *)
func connection(withMediaType mediaType: String!) -> AVCaptureConnection!
@available(iOS 10.0, *)
@objc(capturePhotoWithSettings:delegate:)
func capturePhoto(with settings: AVCapturePhotoSettings, delegate: 
AVCapturePhotoCaptureDelegate)}

@available(iOS 10.0, *)
extension AVCapturePhotoOutput:AVCapturePhotoOutputType {}

现在我在行扩展 AVCapturePhotoOutput:AVCapturePhotoOutputType {} 上遇到错误,即扩展协议。这是错误

Type 'AVCapturePhotoOutput' does not conform to protocol 'AVCapturePhotoOutputType'

xCode 还提供自动修复选项,当我应用生成两个存根并开始出现错误时,如下图所示。

我不明白为什么在升级到 xCode 9 后会发生这种情况,我们将不胜感激。

【问题讨论】:

    标签: ios swift xcode camera avcapturesession


    【解决方案1】:

    我遇到了完全相同的问题。只需用此协议替换您的协议

    @objc protocol AVCapturePhotoOutputType {
    @available(iOS 10.0, *)
    var isLensStabilizationDuringBracketedCaptureSupported: Bool {get}
    //### `availableRawPhotoPixelFormatTypes` is temporarily renamed to `__availableRawPhotoPixelFormatTypes`,
    //### Maybe more Swiftish refinement is planned, but not yet completed.
    @available(iOS 10.0, *)
    @objc(availableRawPhotoPixelFormatTypes)
    var __availableRawPhotoPixelFormatTypes: [NSNumber] {get}
    @available(iOS 10.0, *)
    var isHighResolutionCaptureEnabled: Bool {get @objc(setHighResolutionCaptureEnabled:) set}
    @available(iOS 10.0, *)
    //### `supportedFlashModes` is temporarily renamed to `__supportedFlashModes`,
    //### Maybe more Swiftish refinement is planned, but not yet completed.
    @objc(supportedFlashModes)
    var __supportedFlashModes: [NSNumber] {get}
    @available(iOS 10.0, *)
    @objc(connectionWithMediaType:)
    func connection(with mediaType: AVMediaType) -> AVCaptureConnection?
    @available(iOS 10.0, *)
    @objc(capturePhotoWithSettings:delegate:)
    func capturePhoto(with settings: AVCapturePhotoSettings, delegate: AVCapturePhotoCaptureDelegate)
    }
    

    干杯:-)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-26
      • 1970-01-01
      相关资源
      最近更新 更多