我目前在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.

其他回答

我的解决办法是。在目标->构建设置->框架搜索路径和添加$(继承)。然而,如果它是一个cocoapods,你的答案可能在输出终端内。

请将此截图与您的构建设置进行比较。 这可能会奏效。 进入框架搜索路径:

有时你必须安装pod。

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

此错误也可能由框架缺少模块映射引起。如果您试图导入的框架是您自己的框架,请检查框架本身的编译器警告。在我的情况下,我的框架正在构建和到位,但有一个构建警告:

警告:没有为目标'MyFramework'找到伞头,模块映射将不会生成

通过解决这个警告(与框架头不匹配模块名有关),我能够导入框架。

对我来说,这发生在RxSwift上,问题是我在Podfile中将其修复为3.0.0。移除版本限制并更新pods将其升级到3.1.0,从而修复了它。