我一直在尝试将 Firebase 导入到我的项目中。我在其他项目中已经这样做过几次,没有任何问题。当我在 AppDelegate 中导入 Firebase 并调用 FirebaseApp.configure() 时,一切都很好,没有问题。
当我在项目的其他部分导入 Firebase/Database 时出现问题,突然在 AppDelegate 中出现错误,没有这样的模块 Firebase,并且我无法调用 FirebaseApp.configure()。
导入的其他 Firebase 模块也会发生这种情况,例如远程配置。
这些是我要导入的 Pod
pod 'Firebase/RemoteConfig'
pod 'Firebase/Database'
我发现的唯一解决方案是制作 Objective C 包装器,在实现文件中导入 Firebase 模块,这样就不会公开导入其他 Firebase 模块。
最佳答案
将 use_frameworks
添加到您的 Podfile
示例
platform :ios, "9.0"
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
use_frameworks!
target 'yourprojectTarget' do
pod 'Firebase'
end
然后
pod install --no-repo-update
关于iOS Swift Firebase SDK 导入问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44842764/