我目前在Swift编码,我有一个错误:

没有这样的模块

但我不明白,因为这个模块在我的项目中,在“链接框架和库”和“嵌入式二进制文件”中声明。

框架是在Objective-C中,所以我为它写了一个桥标头。

请问,如何让Xcode识别框架?


当前回答

我的问题是有多个目标。 我用以下链接解决了这个问题: 配置pod文件正确的方式和修复构建设置

希望有人会觉得有用。

其他回答

在我的情况下,项目上的swift 4库没有编译,所以不可能找到它们并导入。 解决方案是将cocoapods库的编译版本设置为swift 3.2

对我来说,编辑方案->运行,并将调试配置从发布更改为调试解决问题。

假设框架真的在那里,在道路上,等等……删除~/Library/Developer/Xcode/DerivedData/ModuleCache目录(清理项目并删除项目特定的派生数据)。

在执行标准清理时,不会重新构建ModuleCache目录。

Another possible cause in XCode 10 can be the Supported Platforms sometimes gets changed to macOS and the Valid Architectures gets changed to i386 x86_64 for the Pods Projects. Assuming the project is for iOS, then select the Pods Project and change the Supported Platforms to iOS and the Valid Architectures to arm64 arm64e armv7 armv7s, You could do each of the Targets, however that takes longer if you have more than one Pod. Also the Swift version of frameworks in written Swift sometimes gets set to the wrong version.

我安装了pod Fakery, pod被添加到我的Pods文件下,但是当我尝试使用它时,我得到了同样的错误。问题是,我没有构建它,在构建它之后,swift编译器在Fakery swift文件中抛出了一些错误,一些函数已经被重命名,它也为它们提供了修复。在解决了所有这些编译器问题后,构建成功了,我能够使用模块。所以快速的语言兼容性是我的问题。