我目前在Swift编码,我有一个错误:
没有这样的模块
但我不明白,因为这个模块在我的项目中,在“链接框架和库”和“嵌入式二进制文件”中声明。
框架是在Objective-C中,所以我为它写了一个桥标头。
请问,如何让Xcode识别框架?
我目前在Swift编码,我有一个错误:
没有这样的模块
但我不明白,因为这个模块在我的项目中,在“链接框架和库”和“嵌入式二进制文件”中声明。
框架是在Objective-C中,所以我为它写了一个桥标头。
请问,如何让Xcode识别框架?
当前回答
我得到这个问题是因为我在podfile中设置了错误的目标(项目本身而不是UITests部分)。
其他回答
解决苹果iOS xcode Version 12.3 (12C33) Webview问题
简单地做3步:
使用.xcodeproj打开项目 Xcode辞职 从.xcworkspace重新打开项目
全部完成
几天前我也遇到了同样的错误。下面是我解决这个问题的方法:
错误是“模块未找到”
Create Podfile in your root project directory Install cocoapods (a dependency manager for Swift and iOS projects) Run pod install Go to Project Build Settings: Find Objective-c bridging Header under Swift compiler - Code Generation (If you don't find Swift compiler here, probably add a new Swift file to the project) Drag and drop the library header file from left side to bridging header (see image attached) Create a new bridging header file: e.g TestProject-Bridging-Header.h and put under Swift Compiler → Objective-C Generated Interface Header Name (ref, see the image above) In TestProject-Bridging-Header.h file, write #import "Mixpanel/Mixpanel.h" In your Swift file the code should be: Import Mixpanel (i.e name of library)
这是所有。
我不太确定为什么Martin R在评论中对这个问题的回答被如此忽视:
确保您尝试简单地跳过导入框架,因为它已经与桥接头一起添加了。
希望这能有所帮助
当“查找隐式依赖项”选项未选中时,可能会发生此错误。转到编辑方案->构建。
然后勾选这个选项。
我的问题是有多个目标。 我用以下链接解决了这个问题: 配置pod文件正确的方式和修复构建设置
希望有人会觉得有用。