【发布时间】:2020-09-22 04:23:17
【问题描述】:
我对 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
我查看了 SO 上的错误,发现几个相同的问题都使用相同的解决方案,最详细的答案如下:
Module compiled with Swift 5.1 cannot be imported by the Swift 5.1.2 compiler
所以当我尝试这个解决方案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 /Users/admin/eva-official/eva/eva/ios/Flutter -F /Users/admin/eva-official/eva/eva/ios -parse-as-library -c -j4 -output-file-map /Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Objects-normal/x86_64/Runner-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Objects-normal/x86_64/Runner.swiftmodule -emit-module-interface-path /Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Objects-normal/x86_64/Runner.swiftinterface -Xcc -I/Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Runner-generated-files.hmap -Xcc -I/Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Runner-own-target-headers.hmap -Xcc -I/Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Runner-all-target-headers.hmap -Xcc -iquote -Xcc /Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Runner-project-headers.hmap -Xcc -I/Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/DerivedSources-normal/x86_64 -Xcc -I/Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/DerivedSources/x86_64 -Xcc -I/Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/DerivedSources -Xcc -DDEBUG\=1 -emit-objc-header -emit-objc-header-path /Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Objects-normal/x86_64/Runner-Swift.h -import-objc-header /Users/admin/eva-official/eva/eva/ios/Runner/Runner-Bridging-Header.h -pch-output-dir /Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/PrecompiledHeaders -working-directory /Users/admin/eva-official/eva/eva/ios
<unknown>:0: error: using bridging headers with module interfaces is unsupported
Command CompileSwiftSources failed with a nonzero exit code
我尝试过的其他步骤:
- 清理构建
- 删除
~/Library/Developer/Xcode/DerivedData - 重启 Xcode
- 在设备上构建
【问题讨论】:
-
此外,时机很重要,因为我相信 Xcode 已更新,因为当我 rm -rf 我的项目并重新克隆时,它会警告更新配置,并且 BUILD_LIBRARY_FOR_DISTRIBUTION 选项不可用,因此请怀疑更新中的某些内容。