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

没有这样的模块

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

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

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


当前回答

当框架没有正确编译时也会发生这种情况。

在Xcode中打开框架项目,看看Product→Build是否成功。

一旦在框架中修复了构建错误,打开主项目,看看是否可以导入框架。

其他回答

我只是通过删除引用来删除框架,然后再次添加它们。

转到项目所在的文件夹,删除导致错误的插件。对我来说,我删除了导致错误的谷歌移动广告Sdk文件夹,问题已经修复。把它和豆荚放在一起就足够了。

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.

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

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

一直到build-release.xconfig的末尾

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

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

如果是周五下午或凌晨1点之后:

打开xcodeproj而不是xcworkspace将导致如下错误…