Kobi
Kobi

Reputation: 455

Firebase has not been correctly initialized and the "GoogleService-Info.plist" file in the required folder

My app working correctly on Android but I have exception on iOS.

The iOS build was done on Codemagic.

Dev. environment - Windows Flutter Dart.

What is missing?

The exception on the following line in mainCommon

FirebaseApp firebaseApp = await Firebase.initializeApp();

mainCommon -

Future<void> mainCommon() async  {
  try {
    loggerDBND("START - MainComminStart0");
    FirebaseApp firebaseApp = await Firebase.initializeApp();

    loggerDBND("START - MainComminStart1");
    FirebaseMessaging.onBackgroundMessage(_messageHandler0);

    loggerDBND("START - MainComminStart2");
    globals.messaging = await FirebaseMessaging.instance;

    loggerDBND("START - MainComminStart3");
    globals.messaging.requestPermission();

    loggerDBND("START - MainComminStart4");
    await globals.messaging.subscribeToTopic("messaging");

    loggerDBND("START - MainComminStart5");
    globals.messaging.getToken().then((value) {
      print("Token -" + value.toString() + "-");
    });

    loggerDBND("START - MainComminStart6");


  } on Exception catch (exception) {
    loggerDBN("mainCommon - exception"+exception.toString() );
  } catch (error) {
    loggerDBN("mainCommon - error" + error.toString());
  }

The exception -

main- error[core/not-initialized] Firebase has not been correctly initialized. Have you added the "GoogleService-Info.plist" file to the project? 
    
View the iOS Installation documentation for more information: https://firebase.flutter.dev/docs/installation/ios

File "GoogleService-Info.plist" location - ....\ios\Runner

Upvotes: 0

Views: 396

Answers (1)

van
van

Reputation: 600

In a similar issue from the past, adding GoogleService-Info.plist to the correct folder by dragging and dropping the file using Apple's Xcode was the solution.

Another user provided a windows workaround

Upvotes: 2

Related Questions