配置了默认的 Firebase 应用 __FIRAPP_DEFAULT
Configured the default Firebase app __FIRAPP_DEFAULT
当遵循在 yaml 文件中添加 firebase 依赖项的 flutter 教程示例时,我会在控制台中获得此打印输出“配置默认的 Firebase 应用程序 __FIRAPP_DEFAULT”:
dependencies:
flutter:
sdk: flutter
firebase_core: ^0.4.0+6
cloud_functions: ^0.4.0+2
firebase_auth: ^0.11.1+7
firebase_database: ^3.0.3
firebase_storage: ^3.0.2
在我的特定工作流程中,在添加 firebase 依赖项时,教程代码和 flutter 警告从未提示修改 AppDelegate.m 文件。直到我拨回并添加 cloud_firestore 时,我才收到此警告提示:
6.3.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add [FIRApp configure]; (FirebaseApp.configure() in Swift) to your application initialization.
阅读更多:[https://firebase.google.com/docs/ios/setup#initialize_firebase_in_your_app].
- 打开 xc 工作区 >> 打开 ios/Runner.xcworkspace
- 打开AppDelegate.m
- 在 AppDelegate.m 中添加以下行:
import Firebase;
- 在 AppDelegate.m 中将以下代码片段添加到您的应用程序 did finish 方法中
[FIRApp configure];
这是我的最后的样子:
在AppDelegate.swift中更改
的顺序
GeneratedPluginRegistrant.register(with: self)
FirebaseApp.configure()
至:
FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self)
清理并重建...
我的AppDelegate.swift
import UIKit
import Flutter
import Firebase
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
要解决此问题,您必须使用 Xcode 将 GoogleService-Info.plist
添加到 Runner。
打开Xcode,然后右击Runner目录和select添加文件到“跑步者”。
Select GoogleService-Info.plist 来自文件管理器。
将出现一个对话框,要求您 select 目标,select 亚军目标。
当遵循在 yaml 文件中添加 firebase 依赖项的 flutter 教程示例时,我会在控制台中获得此打印输出“配置默认的 Firebase 应用程序 __FIRAPP_DEFAULT”:
dependencies:
flutter:
sdk: flutter
firebase_core: ^0.4.0+6
cloud_functions: ^0.4.0+2
firebase_auth: ^0.11.1+7
firebase_database: ^3.0.3
firebase_storage: ^3.0.2
在我的特定工作流程中,在添加 firebase 依赖项时,教程代码和 flutter 警告从未提示修改 AppDelegate.m 文件。直到我拨回并添加 cloud_firestore 时,我才收到此警告提示:
6.3.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add [FIRApp configure]; (FirebaseApp.configure() in Swift) to your application initialization.
阅读更多:[https://firebase.google.com/docs/ios/setup#initialize_firebase_in_your_app].
- 打开 xc 工作区 >> 打开 ios/Runner.xcworkspace
- 打开AppDelegate.m
- 在 AppDelegate.m 中添加以下行:
import Firebase;
- 在 AppDelegate.m 中将以下代码片段添加到您的应用程序 did finish 方法中
[FIRApp configure];
这是我的最后的样子:
在AppDelegate.swift中更改
的顺序GeneratedPluginRegistrant.register(with: self)
FirebaseApp.configure()
至:
FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self)
清理并重建...
我的AppDelegate.swift
import UIKit
import Flutter
import Firebase
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
要解决此问题,您必须使用 Xcode 将 GoogleService-Info.plist
添加到 Runner。
打开Xcode,然后右击Runner目录和select添加文件到“跑步者”。
Select GoogleService-Info.plist 来自文件管理器。
将出现一个对话框,要求您 select 目标,select 亚军目标。