首页 > 解决方案 > 如何让 AWS 框架在 Xcode 11 中工作?

问题描述

我试图通过手动导入 AWS 框架在 Xcode(版本 11.2.1)中工作。我让它们工作的唯一方法是将它们添加到构建阶段下的嵌入框架中。一切都很好,直到我将 AWSMobileClient 导入我的一个 swift 文件中。这里出了问题。如果我尝试在设备模拟器上构建项目,我会收到此错误:

Could not find module 'AWSMobileClient' for target 'x86_64-apple-ios-simulator'; found: arm64, armv7-apple-ios, arm64-apple-ios, arm, armv7

然后我切换到物理设备,我得到这个错误:

Module compiled with Swift 5.1 cannot be imported by the Swift 5.1.2 compiler: /Users/lukacefarin/Library/Mobile Documents/com~apple~CloudDocs/Projects/InoSupport/AWSMobileClient.framework/Modules/AWSMobileClient.swiftmodule/arm64-apple-ios.swiftmodule

我在堆栈溢出时读到了这个错误,除了等待 AWS 修复它之外,我似乎无能为力。

有什么解决方法吗?我所有的项目框架都是手动导入的,所以我不想使用 Cocoapods 或 Carthage。

2020 年 2 月 9 日编辑

我在 GitHub 上发布了这个问题,并得到了他们正在研究解决方案的重播。我猜到那时使用依赖管理器。

标签: iosswiftxcodeaws-sdkaws-amplify

解决方案


正如你所见,我遇到了同样的问题,我的本地 swift 版本是 5.1.3。

"Incompatible Swift version - framework was built with 5.1 (swiftlang-1100.0.270.13 clang-1100.0.33.7) and the local version is 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)."

所以,我不得不寻找与我安装的 swift 版本 5.1.3 兼容的 aws-sdk-ios 版本。

您安装的 swift 版本是 5.1.2。在我的尝试中,我发现了一个与您本地版本的 swift 5.1.2 兼容的 aws-sdk-ios 版本。

尝试使用 aws-sdk-ios "2.13.0",我的日志说这个框架是用 5.1.2 构建的。

*** Checking out aws-sdk-ios at "2.13.0"
*** Downloading aws-sdk-ios.framework binary at "AWS SDK for iOS 2.13.0"
***  Skipped installing aws-sdk-ios.framework binary due to the error:
"Incompatible Swift version - framework was built with 5.1.2 (swiftlang-1100.0.278 clang-1100.0.33.9) and the local version is 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)."

推荐阅读