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

没有这样的模块

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

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

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


当前回答

您将依赖项(模块)添加到pod中,但没有版本(特定或范围)。 请定义版本,运行pod install,并打开。xcworkspace文件,而不是。xcodeproj文件

其他回答

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.

在极少数情况下,此错误可以通过在[ProjectNavigator]->[项目]->[目标]->(架构)BaseSDK设置适当的平台来修复

当创建一个框架时,我不小心选择了错误的模板(因为我之前创建macOS框架),因为它被设置为喜欢我之前的选择。当添加目标时,很容易忽略配置平台,所以要仔细检查。

在我的例子中,我只需要重新加载项目。我使用命令行克隆我的项目,但它没有正确安装子模块。为了补救,我通过XCode克隆了项目,一切正常。只是要确保先备份所有更改。

有时你必须安装pod。

打开终端 cd项目 圆荚体安装 打开.xcworkspace和 构建是成功的

对我有效的是另一个问题的解决方案。关闭Xcode,重新打开项目作为工作空间。转到项目文件夹并打开.xcodeworkspace文件。 一旦你打开工作区(而不是项目),Pods应该作为顶级项目出现在project Navigator中。