Firebase(4.0.0):安装FirebaseDatabase时使用未解析标识符FirebaseApp
情况就是这样:Firebase(4.0.0):安装FirebaseDatabase时使用未解析标识符FirebaseApp,firebase,cocoapods,Firebase,Cocoapods,情况就是这样: 在Xcode 7.3.1版(7D1014)上运行 吊舱“火力基地/核心” 在类中导入Firebase 然后我添加了数据库框架 吊舱“火力基地/核心” 吊舱“火力基地/数据库” 这两个框架似乎都处于互斥模式。它们不能共存 我尝试了一切:更新、安装、卸载、重新创建项目、重新创建工作区。全部 你能帮助我吗。上一个Firebase版本中有bug吗?听起来您可能正在使用旧版本的Firebase。试一试- pod repo update pod update 仔细检查Fireb
- 在Xcode 7.3.1版(7D1014)上运行
- 吊舱“火力基地/核心”
- 在类中导入Firebase
- 吊舱“火力基地/核心”
- 吊舱“火力基地/数据库”
你能帮助我吗。上一个Firebase版本中有bug吗?听起来您可能正在使用旧版本的Firebase。试一试-
pod repo update
pod update
仔细检查Firebase 4.0是否已安装
还可以尝试导入特定模块。所以不是
import Firebase
使用import FirebaseDatabase
或import FirebaseAuth
使用FIRApp.configure()而不是Firebase.configure()我遇到了类似的问题
您的进口声明如下:
import Firebase
确保重新启动Xcode并清理生成文件夹
它对我有用&摆脱了“使用未解析标识符FirebaseApp…”错误
更新:对于Swift 4.2:
FirebaseApp.configure()
有效。[FIRApp重命名为FirebaseApp]将吊舱“Firebase/Core”替换为吊舱“Firebase”
。
然后运行今天对我有用的pod repo update
:
1。在Xcode 9.1中
import UIKit
import Firebase
import UserNotifications
import FirebaseInstanceID
import FirebaseMessaging
import FirebaseCrash
import FirebaseAnalytics
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
return true
}
2。我的播客文件
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Crash'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Storage'
pod 'FirebaseUI', '~> 4.0'
pod 'Firebase/Auth'
pod 'Firebase/Messaging'
3。结局:
pod repo update
pod update
4。重新启动xcode:
pod repo update
pod update
5。按:shift-alt-command-k(在xcode中)
这将删除生成文件夹中的所有产品和中间文件。这与删除派生数据不同
6。干净的
完成
然后可以使用FirebaseApp.configure()
。我正在使用swift 4。我在播客文件中沿w/“Firebase/Core”添加了“Firebase”,它对我起了作用它对我起了作用
pod repo update
pod update
然后在pod文件的位置运行此:
pod install
重建我的应用程序后,错误应该消失。使用FIRApp.configure()而不是FirebaseApp。对于那些面临RemoteConfig配置问题的用户,添加额外的导入:
import FirebaseRemoteConfig
在我的案例中有帮助在我的案例中,我需要导入FirebaseCore
,而不是导入Firebase
或导入FirebaseRemoteConfig
导入FirebaseCore
将此添加到类的顶部解决了我的问题
FirebaseCore版本:6.29.0这可能太晚了,但如果您确定您的pod文件是正确的,并且您的应用程序以前已经构建过。
当这个错误突然出现时,请记住另一个可能出错的地方是Xcode的增量构建文件夹
试试这个:
相当高的Xcode
在finder中找到生成文件夹和DerivedData文件夹
删除生成文件夹和DerivedData文件夹
通过Xcode重建
希望到时候你会没事。Firebase的人告诉我这是一个bug,他们正在提供解决方案。这个问题在Xcode 8中没有发生。@GiancarloMarasso您的项目使用的是Swift 2还是Swift 3?我的项目是用Swift 2编写的,我在Xcode 8.3.2中遇到了同样的问题。我做了“pod回购更新”和“pod更新”,我的Firebase版本仍然显示为3.17.0。我需要做些什么才能将其强制到4.0吗?@RyanTensmeyer在你的pod文件中,你是否在使用任何东西来限制Firebase pod的版本?如果你有类似于“~>3”的内容,你将无法获得版本4。请发布完整的播客文件好吗?我想我知道答案了。这太棒了!为什么文档是错的?!?!可能他们还没有更新文档。发生;)@frank van puffelen我们可以在iOS的文档和控制台启动指南中修复这个问题吗?如果您使用的是旧版本的Firebase(这是cocoapods默认回购协议所指向的)。本文档是为Firebase 4.8+编写的。Chris Edgington下面的回答将通过更新您的回购(运行pod repo update&&pod update
)来解决这个问题。谢谢!cocoapos gem不是最新的,它在v3.x中安装了firebase吊舱,这是正确的解决方案,应该标记为答案。将其更改为FIRApp是一个过时的解决方案。我同意,这应该标记为正确答案。@nzackoya,我应该在哪个目录中更新cocoapods???@ArgaPK您的项目目录。同时确保您导入Firebase。为我工作。为什么会这样?在我的案例中,需要导入的是FirebaseCore。这解决了我的问题,但也向我展示了我的案例中的错误。安装Crashlytics的说明只告诉您将pod'Firebase/Crashlytics'
添加到您的pod文件中,但我认为可能假设您也已经有pod'Firebase'
。将Firebase
添加到我的pod文件中,允许我导入Firebase
而不是导入FirebaseCore
。文档说只需导入Firebase
,它在AppDelegate.swift
中工作。但不是在另一个swift文件中。我需要导入FirebaseCore
import FirebaseRemoteConfig