繁体   English   中英

Xcode 11 “'==' 仅在 iOS 13.0 或更高版本中可用”错误

[英]Xcode 11 “'==' is only available in iOS 13.0 or newer” error

我试图在 Xcode 11 中构建我的项目,它抛出了 26 个相同的错误

<unknown>:0: error: '==' is only available in iOS 13.0 or newer 

在调用CompileSwift normal arm64 /long/path/to/MyClass.swift...时,错误发生在Compile Swift source files stage 没有上下文帮助指向文件的任何内容。 这些文件完全不同,但看起来无害,并且没有任何共同之处。

经过一番痛苦,我发现 4 个月大的应用程序版本编译正常。 所以我做了git bisect并找到了有问题的提交,然后是这段代码:

struct Config: Equatable {
    let formatDescription: CMFormatDescription
    let orientation: CGImagePropertyOrientation
}

Turns out CMFormatDescription did become Equatable only in iOS 13, while the app deployment target is iOS 11. It probably felt back to [NSObject isEqual:] in Xcode 10, but it became complicated in Xcode 11. Since Swift automatically generates Equatable conformance under the引擎盖在指出错误的确切位置时遇到了麻烦。 解决方案是为CMFormatDescription添加您自己的Equatable实现:

extension CMFormatDescription: Equatable {
    public static func == (lhs: CMFormatDescription, rhs: CMFormatDescription) -> Bool {
        return CMFormatDescriptionEqual(lhs, otherFormatDescription: rhs)
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM