我对 Xcode 开发还比较陌生。本质上,我正在开发的项目使用了PolarBleSdk库,该库也具有 RxSwift 依赖项。我将它们添加为框架/编译模块,上周两者都运行正常。今天我去运行我的项目并得到以下错误:
Module compiled with Swift 5.2 cannot be imported by the Swift 5.3 compiler: /Users/admin/eva-official/eva/eva/ios/PolarBleSdk.framework/Modules/PolarBleSdk.swiftmodule/x86_64-apple-ios-simulator.swiftmodule
Run Code Online (Sandbox Code Playgroud)
我查看了 SO 上的错误,发现几个相同的问题都具有相同的解决方案,最详细的答案如下:
使用 Swift 5.1 编译的模块无法被 Swift 5.1.2 编译器导入
因此,当我尝试此解决方案时,BUILD_LIBRARY_FOR_DISTRIBUTION = YES;我收到此错误:
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'Runner' from project 'Runner')
cd /Users/admin/eva-official/eva/eva/ios
export DEVELOPER_DIR\=/Applications/Xcode.app/Contents/Developer
export SDKROOT\=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.0.sdk
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name Runner -Onone -enable-batch-mode -enforce-exclusivity\=checked @/Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Objects-normal/x86_64/Runner.SwiftFileList -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.0.sdk -target x86_64-apple-ios12.4-simulator -g -module-cache-path /Users/admin/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -Xfrontend -serialize-debugging-options -enable-testing -index-store-path /Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Index/DataStore -enable-library-evolution -swift-version 5 -I /Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Products/Debug-iphonesimulator -F /Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Products/Debug-iphonesimulator -F …Run Code Online (Sandbox Code Playgroud)