my flutter/firebase app showing no app has been configured yet

淺唱寂寞╮ 提交于 2021-02-08 11:45:54

问题


i am making app in flutter/firebase and i am experiencing the following error on my visual studio code terminal:-

Xcode build done.                                           522.2s
6.26.0 - [Firebase/Core][I-COR000005] No app has been configured yet.
6.26.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications 
proxy enabled, will swizzle remote notification receiver handlers. If you'd 
prefer to manually integrate Firebase Messaging, add 
"FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow 
the instructions at:
https://firebase.google.com/docs/cloud- 
messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
Waiting for iPhone 11 to report its views...                         9ms
Syncing files to device iPhone 11...                               610ms

any ideas on how to solve this issue......????


回答1:


Here is another method to initialize Firebase which is done by editing your main.dart.

This is probably the preferred solution, because it doesn't initialize Firebase until all of your application widgets are initialized. I had a situation where some Widgets weren't working because their reference to the Firebase instance was null.

WidgetsFlutterBinding.ensureInitialized(); is necessary to do class initialization.

Although the solution given by Sai works, I suspect it doesn't always work due to a subtle initialization issue.

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  runApp(MyApp());
}



回答2:


I solved the issue. If you are using swift in your AppDelegate.swift, make sure you've added the following in that order:

FirebaseApp.configure() //add this before the code below
GeneratedPluginRegistrant.register(with: self)

If you're using flutter with objective-c, add the following to your appdelgate.m file:-

didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[FIRApp configure]; //add this right after the above



回答3:


with adding FirebaseApp.configure(), do not forget to import Firebase



来源:https://stackoverflow.com/questions/64014893/my-flutter-firebase-app-showing-no-app-has-been-configured-yet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!