将 Xcode 8 升级到 XCode 9 后出现 AvCapture 错误

AvCapture error after upgrading Xcode 8 to XCode 9

我正在处理另一个开发人员的代码,它是一个相机应用程序。在升级到 xCode 9 之前,我对其进行了处理,它运行良好。下面是代码片段

@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 {} 上遇到错误,即扩展 protocol.This 是错误

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

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

我不明白为什么升级到xCode9后会发生这种情况,任何帮助将不胜感激。

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

@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)
}

干杯:-)