Description
问题描述:
用 Xcode 10.2 以下的版本 打包生成的 RokidSDK.framework(lipo -create 合并之后的) 在 Xcode 10.2上编译无法通过,
错误如下:
ld: xxx/RokidSDK/RokidSDK.framework/RokidSDK compiled with other version of Swift language (`unkown ABI version 0x06`) than previous files (`unknown ABI version 0x07`)file 'xxx/RokidSDK/RokidSDK.framework/RokidSDK' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
尝试方案
Xcode 升级到 10.2 之后,重新打包生成的 RokidSDK.framework(lipo -create 合并之后的) 放到 RokidMobileSDKiOSDemo 项目中时,在模拟器上无法编译通过,报一些文件无法找到的错误,但在真机上市可以编译通过。
最终方案
最终发现在 Xcode 更新日志有段描述:
Known Issues
If you’re building a framework containing Swift code and using lipo to create a binary that supports both device and simulator platforms, you must also combine the generated Framework-Swift.h headers for each platform to create a header that supports both device and simulator platforms. (48635615)
For example, if you’ve built:
-
iOS/Framework.framework
-
iOS Simulator/Framework.framework
Take:
-
iOS/Framework.framework/Headers/Framework-Swift.h
-
iOS Simulator/Framework.framework/Framework-Swift.h
Create a new:
- iOS + iOS Simulator/Framework.framework/Headers/Framework-Swift.h
The contents of the new Framework-Swift.h should be:
#if TARGET_OS_SIMULATOR
<contents of original iOS Simulator/Framework.framework/Framework-Swift.h>
#else
<contents of original iOS/Framework.framework/Framework-Swift.h>
#endif
需要把模拟器和用lipo create 合并之后的 framework 中的 Framework-Swift.h 头文件用一个宏 TARGET_OS_SIMULATOR 手动拼接到一起,生成一个完整的 Framework-Swift.h 的头文件。
Activity
KingBo0259 commentedon Mar 27, 2019
解决方案连接:https://developer.apple.com/documentation/xcode_release_notes/xcode_10_2_release_notes
Beyond-Chao commentedon Apr 24, 2019
類似問題 Carthage #2718