因此,每次在我的pod文件中,我决定使用pod' Firebase / Core'添加pod' Firebase / Storage'之类的东西,在我的应用程序中,精致的FirebaseApp.configure()
使用了未解决的标识符' FirebaseApp'我的pod文件是
https://docs.google.com/document/d/1U7s5StRuNrI_2WtpHSvHhwhA1TMCsQ255dnjDAEhhcE/edit?usp=sharing
答案 0 :(得分:74)
我通过使用FirebaseCore而不是Firebase库解决了这个问题:
import FirebaseCore
答案 1 :(得分:11)
您的appdelegate类应如下所示:
import UIKit
import Firebase
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FIRApp.configure()
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
我假设你使用的是xcode 8和swift 3。
答案 2 :(得分:5)
至少运行Firebase 6.31.1运行pod update
。
Firebase在6.28.0中进行了更改,从而暴露了Xcode构建竞争条件。更改在6.31.1中进行了还原。详细信息,https://github.com/firebase/firebase-ios-sdk/issues/6341
答案 3 :(得分:2)
在我的情况下是因为我使用的是较旧版本的Firebase(3.11.1)
pod repo update
pod update
更新后,我的repo和我的本地规格存储库使用Firebase(4.2.0)FirebaseApp由Xcode解决了!
答案 4 :(得分:2)
尝试pod' Firebase'而不是pod' Firebase / Core'
检查“安装”后是否安装了Firebase 4.x
答案 5 :(得分:2)
使用“ import FirebaseCore”代替“ import FirebaseCore”
答案 6 :(得分:0)
这将解决此问题
sudo gem install cocoapods
pod update
答案 7 :(得分:0)
morganchen12 在此GitHub评论中的解决方案为我解决了同样的问题。我需要修改单元测试的Podfile(OP已经完成),然后将Firebase添加到Header Search路径。
为了保存,评论是:
问题是由测试运行时中的重复FIRApp类定义引起的。
您的Podfile应如下所示:
target "FirebaseDemo" do install_pods target "FirebaseDemoTests" do inherit! :search_paths end end
为了避免丢失所需的模块Firebase错误,请将“$ {PODS_ROOT} / Firebase / Core / Sources”添加到Xcode中测试目标的标头搜索路径的末尾。