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

没有这样的模块

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

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

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


当前回答

Sazzad Hissain Khan的3分。选项添加相同的“构建配置”在应用程序的框架,而不是在应用程序解决了我的“未知模块”问题。

这篇文章帮助我了解如何添加新的构建配置,因为进入编辑器->添加配置是灰色的

在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.

为了它的价值(我是使用Xcode 7.2/Swift 2的新手),但我注意到,只要从项目目录中的库中拥有. Swift文件,就可以自动地访问它,而不需要using语句。

示例:我正在使用SwiftyJSON,在项目中拥有SwiftyJSON.swift文件就是我所需要的。using语句实际上给了我“没有这样的模块”错误,并把它解决了,它工作得很好。

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

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

希望这能有所帮助

我得到这个问题是因为我在podfile中设置了错误的目标(项目本身而不是UITests部分)。

有时你必须安装pod。

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