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

没有这样的模块

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

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

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


当前回答

当我使用Cocoapods添加两个框架时,我得到了相同的错误。如果我们在项目中使用Pods,我们应该使用xcodeworkspace而不是xcodeproject。 为了通过xcodebuild运行项目,我在xcodebuild命令中添加了-workspace <workspacename>参数,它工作得很好。

其他回答

如果你是面向tvOS这样的平台创造游戏,请确保你选择了一个Apple TV模拟器。

使用iOS模拟器创建tvOS应用时,我就犯了这个错误。花了大半个小时寻找各种构建问题……哎。

对于那些有多个目标的人,检查是否在正确的目标上添加了框架。(在框架、库和嵌入式内容中)。

这是最后对我有用的方法。我不得不做这一切,这很蹩脚,但这是我能找到的唯一有效的方法。

在确保图书馆被列在链接框架和图书馆。如果没有,你可以点击+,希望能看到你的框架/pod。

在方案图标中单击您的项目(见下图)

然后你会看到你的关注点框架:

单击“管理方案”。

然后你会看到如下内容:

勾选框架的方框,单击自动创建方案,然后关闭。

然后尝试再次导入框架/pod。

这对我很管用。

我仍然不能从xcode存档,但fastlane为我做了这项工作

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

错误是“模块未找到”

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)

这是所有。