Aar*_*sen 7 dart firebase firebase-authentication flutter flutter-dependencies
在遵循 flutter 教程示例以在 yaml 文件中添加 firebase 依赖项时,我会在控制台“配置默认 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
Run Code Online (Sandbox Code Playgroud)
Aar*_*sen 12
在我的特定工作流程中,添加 firebase 依赖项时,教程代码和颤振警告从未提示修改 AppDelegate.m 文件。直到我回拨并添加 cloud_firestore 才收到此警告提示:
6.3.0 - [Firebase/Core][I-COR000003] 尚未配置默认 Firebase 应用。添加【FIRApp配置】;(Swift 中的 FirebaseApp.configure())到您的应用程序初始化。
阅读更多:[ https://firebase.google.com/docs/ios/setup#initialize_firebase_in_your_app]。
导入 Firebase;
【FIRApp配置】;
这是我最后的样子:
在 AppDelegate.swift 中更改顺序
GeneratedPluginRegistrant.register(with: self)
FirebaseApp.configure()
Run Code Online (Sandbox Code Playgroud)
到:
FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self)
Run Code Online (Sandbox Code Playgroud)
清理并重建...
我的 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)
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10932 次 |
| 最近记录: |