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

没有这样的模块

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

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

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


当前回答

我在开发定制Pod时遇到了这个问题。发现我只需要在我的Procfile中指定依赖项:

Pod::Spec.new do |s|
   # ... other declarations

   s.dependency 'Alamofire', '~> 4.3'
end

其他回答

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

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

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

错误是“模块未找到”

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)

这是所有。

在podfile中,删除产生问题的pod,并保存该文件 运行pod安装 重新添加pod,保存文件 重新运行pod安装

我发现构建设置中的导入路径是错误的自定义(MySQL)模块。把它指向正确的方向后,信息就消失了。

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