Swift Project: quot;Missing Required Modulesquot; when import a modular framework(Swift 项目:“缺少必需的模块;导入模块化框架时)
问题描述
设置
我创建了一个包含 C 库 (CommonCrypto) 和一个 Objective C 文件的 swift 框架.
swift 项目中没有桥头.所以我创建了一个
module.modulemap来将 CommonCrypto 和 Objective-C 文件导入到我的 swift 框架中.module.modulemap 内容:
这是 module.modulemap 示例链接:
所以,在我的 swift 框架中,一切正常.我可以像这样使用模数
问题展示
归档模块化框架并作为构建产品导出.
在我的 swift 示例项目中,将模块化框架添加到 Embedded Binaries
当我在框架内使用某些东西时,此行出现错误
我已经尝试了很多解决方案,但仍然无法正常工作.
类似的问题:
<块引用>备注
如果框架存档在同一个开发环境中,则无需将 module.modulemap 添加到示例项目中.
Setup
I create a swift framework which include C library (CommonCrypto) and a Objective C file.
There is no bridge-header in swift project. So I create a
module.modulemapto import CommonCrypto and Objective-C file into my swift framework.module.modulemap content:
Here is the module.modulemap sample link:Importing CommonCrypto in a swift framework
In project settings, adding modulus.modulusmap path to swift compile
So, in my swift framework, everything works fine. I can use modulus like this
Problem shows
Archive the modular framework and export as a built products.
In my swift sample project, add modular framework to Embedded Binaries
Error occurs on this line when I use something inside the framework
I have try so many solutions, but still not work.
Similar problems:
Swift app: "Missing required module" when importing framework that imports static library
Adding RealmSwift as a subproject: Missing required modules: 'Realm.Private', 'Realm'
Is anyone have a good solution for this? Thx!!
解决方案Solution
iOS framework exists as a folder, create a
module.modulemapto find out library or header file.Setup
module.modulemappathIn project/target/Build Settings/Swift Compile - Search Path/Import Path = "${SRCROOT}"
Add below to
module.modulemap
Remarks
You don't have to add module.modulemap to the sample project if the framework is archived on the same development environment.
这篇关于Swift 项目:“缺少必需的模块";导入模块化框架时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Swift 项目:“缺少必需的模块";导入模块化框架时
基础教程推荐
- UIImage 在开始时不适合 UIScrollView 2022-01-01
- Xcode UIView.init(frame:) 只能在主线程中使用 2022-01-01
- Android Volley - 如何动画图像加载? 2022-01-01
- 如何比较两个 NSDate:哪个是最近的? 2022-01-01
- iOS - UINavigationController 添加多个正确的项目? 2022-01-01
- 为什么姜饼模拟器方向卡在应用程序中? 2022-01-01
- 如何将图像从一项活动发送到另一项活动? 2022-01-01
- navigationItem.backBarButtonItem 不工作?为什么上一个菜单仍然显示为按钮? 2022-01-01
- SwiftUI-ScrollViewReader的ScrollTo不滚动 2022-01-01
- Play 商店的设备兼容性问题 2022-01-01
