我目前在Swift编码,我有一个错误:
没有这样的模块
但我不明白,因为这个模块在我的项目中,在“链接框架和库”和“嵌入式二进制文件”中声明。
框架是在Objective-C中,所以我为它写了一个桥标头。
请问,如何让Xcode识别框架?
我目前在Swift编码,我有一个错误:
没有这样的模块
但我不明白,因为这个模块在我的项目中,在“链接框架和库”和“嵌入式二进制文件”中声明。
框架是在Objective-C中,所以我为它写了一个桥标头。
请问,如何让Xcode识别框架?
当前回答
我用
链接的框架和库
将框架添加到Workspace文件夹的顶部。讨厌鬼。
其他回答
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.
我得到了相同的错误
import Firebase
但随后注意到,我没有将pod添加到主目标部分,而只是在Podfile中添加到Test和TestUI目标。
用命令
pod init
对于xcode swift项目,会生成以下Podfile
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
因此,需要确保将pod添加到任何适当的占位符。
实际上,通过添加到build-debug.xconfig的末尾,我更容易地解决了这个问题
#包括“. ./Pods/目标支持文件/Pods- iap /Pods- iap .debug.xcconfig"
一直到build-release.xconfig的末尾
#包括“. ./Pods/目标支持文件/Pods- iap /Pods- iap .release.xcconfig"
因为这些文件已经定义了PODS_ROOT和相关的构建变量。
我在开发自己的第一款应用时也遇到了同样的问题
使用.xcodeproj打开项目
Xcode辞职
从.xcworkspace重新打开项目
我不太确定为什么Martin R在评论中对这个问题的回答被如此忽视:
确保您尝试简单地跳过导入框架,因为它已经与桥接头一起添加了。
希望这能有所帮助