简体   繁体   English

Swift 模块稳定性:Swift XZ 编译器无法导入使用 Swift XY 编译的模块

[英]Swift Module stability: Module compiled with Swift X.Y cannot be imported by the Swift X.Z compiler

Let's start by existing questions,让我们从现有的问题开始,

Module compiled with Swift 5.1 cannot be imported by the Swift 5.1.2 compiler Swift 5.1.2 编译器无法导入使用 Swift 5.1 编译的模块

Module compiled with Swift 5.1 cannot be imported by the Swift 5.0 compiler Swift 5.0 编译器无法导入使用 Swift 5.1 编译的模块

Module compiled with Swift 5.1.2 cannot be imported by the Swift 5.2.4 compiler Swift 5.2.4 编译器无法导入使用 Swift 5.1.2 编译的模块

And, now with XCode 12(12A7209)而且,现在使用 XCode 12(12A7209)

Module compiled with Swift 5.2.4 cannot be imported by the Swift 5.3 compiler Swift 5.3 编译器无法导入使用 Swift 5.2.4 编译的模块

The framework was compiled in the lower version of Swift (Swift 5.2.4).该框架是在较低版本的 Swift (Swift 5.2.4) 中编译的。 However, it worked perfectly with XCode 12 beta.但是,它与 XCode 12 beta 完美配合。

Solution tried:尝试的解决方案:

Whole point is the Swift ABI stability for binary framework and how to achieve it across different swift version.重点是二进制框架的 Swift ABI 稳定性以及如何在不同的 Swift 版本中实现它。

Please advice.请指教。 Thank you in advance!先感谢您!

You need Module Stability, not ABI stability.您需要模块稳定性,而不是 ABI 稳定性。

The difference and the way how to achieve Module Stability, are described here: https://www.donnywals.com/what-is-module-stability-in-swift-and-why-should-you-care/这里描述了如何实现模块稳定性的差异和方式: https : //www.donnywals.com/what-is-module-stability-in-swift-and-why-should-you-care/

Here is WWDC session that explains swift binary frameworks (time code: 17:00).这是解释 swift 二进制框架的WWDC 会议(时间代码:17:00)。

Briefly, your framework简而言之,您的框架

  • should be built with Build Libraries for Distribution set to Yes应该在Build Libraries for Distribution设置为Yes Build Libraries for Distribution
  • distributed as .xcframework with variants for simulator and device作为.xcframework分发,带有模拟器和设备的变体

You'll need to ensure that frameworks embedded into .xcframework all have .swiftinterface file inside of Modules/<name>.swiftmodule folder.你需要确保嵌入到框架.xcframework都有.swiftinterface的文件中Modules/<name>.swiftmodule文件夹。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我可以将swift版本降级为中度错误“使用Swift xx编译的模块无法由Swift xx编译器导入”吗? - Can I downgrade swift version to moderate error 'Module compiled with Swift x.x cannot be imported by the Swift x.x compiler'? 使用Swift 4.1.2编译的模块不能由Swift 4.2编译器导入 - Module compiled with Swift 4.1.2 cannot be imported by the Swift 4.2 compiler 使用Swift 5.0编译的模块不能由Swift 4.2.1编译器导入 - Module compiled with Swift 5.0 cannot be imported by the Swift 4.2.1 compiler Swift 5.0.1 编译的模块不能被 Swift 5.1 编译器导入 - Module compiled with Swift 5.0.1 cannot be imported by the Swift 5.1 compiler Swift 5.1编译的模块不能被Swift 5.1.2编译器导入 - Module compiled with Swift 5.1 cannot be imported by the Swift 5.1.2 compiler 使用 Swift 5.2.4 编译的模块不能被 Swift 5.3.1 编译器导入 - Module compiled with Swift 5.2.4 cannot be imported by the Swift 5.3.1 compiler Swift 5.0 编译器无法导入使用 Swift 4.2.1 编译的模块 - Module compiled with Swift 4.2.1 cannot be imported by the Swift 5.0 compiler Swift 4.2.1编译器无法导入使用Swift 4.0.3编译的模块 - Module compiled with Swift 4.0.3 cannot be imported by the Swift 4.2.1 compiler 使用 Swift 5.3.1 编译的模块不能被 Swift 5.1.3 编译器导入 - Module compiled with Swift 5.3.1 cannot be imported by the Swift 5.1.3 compiler 用 Swift 5.3.2 编译的模块不能被 Swift 5.6 编译器导入 - Module compiled with Swift 5.3.2 cannot be imported by the Swift 5.6 compiler
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM