使用 Xcode 12 beta 3 调用:
import AVFoundation
在 Swift 文件中导致构建失败。错误文本包括:
Failed to build module 'AVFoundation' from its module interface; the compiler that produced it, [...], may have used features that aren't supported by this compiler.
有解决办法吗? (重新表述为关于 SO 的问答,以帮助其他开发人员使用此测试版)
最佳答案
extension AVAudioSession.Location
需要标记为 unavailable
for macOS。
编辑相关的 .swift-interface 文件。安装在/Applications 中时,该文件应位于:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/swift/AVFoundation.swiftmodule/x86_64-apple-macos.swiftinterface
有 2 个位置可以更改自:
@available(iOS 7.0, watchOS 2.0, tvOS 9.0, *)
extension AVAudioSession.Location {
到:
@available(OSX, unavailable)
@available(iOS 7.0, watchOS 2.0, tvOS 9.0, *)
extension AVAudioSession.Location {
非常感谢 Apple 开发者论坛上的用户 eldevo(问题)和 Gerrit(回答),请参阅 https://developer.apple.com/forums/thread/655334
关于swift - 如何在 Xcode 12 beta 3 中使用 Swift 成功导入 AVFoundation?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63112908/