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

没有这样的模块

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

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

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


当前回答

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

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

你应该更新cocoapods

gem which cocoapods

其他回答

我刚刚删除了我的cocoapod。然后,我做了一个豆荚安装来移除它。然后,我只是把它添加回我的podfile,并重新安装它。这让它成功了。不知道为什么。

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

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

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

希望有人会觉得有用。

几天前我也遇到了同样的错误。下面是我解决这个问题的方法:

错误是“模块未找到”

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)

这是所有。

实际上,通过添加到build-debug.xconfig的末尾,我更容易地解决了这个问题

#包括“. ./Pods/目标支持文件/Pods- iap /Pods- iap .debug.xcconfig"

一直到build-release.xconfig的末尾

#包括“. ./Pods/目标支持文件/Pods- iap /Pods- iap .release.xcconfig"

因为这些文件已经定义了PODS_ROOT和相关的构建变量。