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

没有这样的模块

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

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

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


当前回答

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.

其他回答

如果工作区中有多个项目,则需要:

向所有项目添加新配置 产品->清洁 删除派生数据 终端吊舱安装 构建您的项目。

TL;DR:检查Podfile中特定于目标的shared_pods

在绞尽脑汁尝试了上周贴在这里的每一个答案之后,我终于找到了一个解决方案。

我有两个独立的目标——一个用于发布,一个用于开发。开发目标是在发布目标之后很久才创建的,这导致我忘记了该目标的一些设置步骤。

我能够使用我的发布目标正确地编译我的项目,但是我的开发目标遇到了一个问题。

在第20次查看我的Podfile后,我注意到在我的shared_pods定义下只有以下内容:

target 'Release' do
  shared_pods
end

我需要做的是将我的第二个目标添加到我的Podfile中,这就解决了这个问题:

target 'Release' do
  shared_pods
end

target 'Development' do
    shared_pods
end

希望这能让一些人少受几天的困扰。

我不太确定为什么Martin R在评论中对这个问题的回答被如此忽视:

确保您尝试简单地跳过导入框架,因为它已经与桥接头一起添加了。

希望这能有所帮助

在尝试了这个线程上的所有想法后,当我更新cocoapods时,它起作用了。

$ pod --version
$ 1.0.0 // should have been 1.10.0

你应该更新cocoapods

gem which cocoapods

对我来说,对于所选配置,“仅构建活动体系结构”被设置为“是”。这招奏效了:

从左侧项目导航器中选择“Pods”>选择“构建设置”>仅将活动架构构建为No