10

I am trying to build my Cordova app with Firebase integrated using Xcode build, but I am getting this vague error, and I can't understand what's wrong. I have placed the GoogleService-Info.plist file in the project directory, but it still fails to build. Here is the stack trace

2017-05-17 09:56:43.610 MyAppz[824:13611] *** Terminating app due to uncaught exception 'com.firebase.core', 
reason: 'Configuration fails. It may be caused by an invalid GOOGLE_APP_ID in GoogleService-Info.plist 
or set in the customized options.'
    *** First throw call stack:
    (
        0   CoreFoundation                      0x00000001099cdb0b __exceptionPreprocess + 171
        1   libobjc.A.dylib                     0x0000000109409141 objc_exception_throw + 48
        2   CoreFoundation                      0x0000000109a36625 +[NSException raise:format:] + 197
        3   MyAppz                            0x0000000107280b70 +[FIRApp addAppToAppDictionary:] + 371
        4   MyAppz                            0x000000010728011b +[FIRApp configureDefaultAppWithOptions:sendingNotifications:] + 285
        5   MyAppz                            0x000000010727fe4f +[FIRApp configure] + 302
        6   MyAppz                            0x000000010721c59a -[AppDelegate(FirebasePlugin) application:swizzledDidFinishLaunchingWithOptions:] + 122
        7   UIKit                               0x000000010a804957 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 299
        8   UIKit                               0x000000010a80623c -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4119
        9   UIKit                               0x000000010a80c584 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1709
        10  UIKit                               0x000000010a809793 -[UIApplication workspaceDidEndTransaction:] + 182
        11  FrontBoardServices                  0x000000010fce15f6 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
        12  FrontBoardServices                  0x000000010fce146d -[FBSSerialQueue _performNext] + 186
        13  FrontBoardServices                  0x000000010fce17f6 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
        14  CoreFoundation                      0x0000000109973c01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
        15  CoreFoundation                      0x00000001099590cf __CFRunLoopDoSources0 + 527
        16  CoreFoundation                      0x00000001099585ff __CFRunLoopRun + 911
        17  CoreFoundation                      0x0000000109958016 CFRunLoopRunSpecific + 406
        18  UIKit                               0x000000010a80802f -[UIApplication _run] + 468
        19  UIKit                               0x000000010a80e0d4 UIApplicationMain + 159
        20  MyAppz                            0x0000000107195df1 main + 65
        21  libdyld.dylib                       0x000000010cc3a65d start + 1
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException

What could be the problem, I don't know what else to show if it's needed, so please ask.

Sartheris Stormhammer
  • 2,534
  • 8
  • 37
  • 81

6 Answers6

17

For some reason Xcode always ignored the GoogleService-Info.plist located in the project root directory, and didn't copied it in the Resources folder of the project.

I manually copied the file there, and then the app compiled and ran just fine.

Sartheris Stormhammer
  • 2,534
  • 8
  • 37
  • 81
  • my case is slightly different. Error is the same but i have already two GoogleService-Info.plist inside .../Resources and /Resources/Resources which appear to be the same of my firebase configuration. What's missed ?? root plist ? if yes .... where is the root? Because xcode give me like first error: "Cannot remove GoogleService.plist ... " – Simone Campagna Oct 02 '18 at 11:30
7

In my case the problem was with the cordova copying GoogleService-Info.plist and corrupting it.

So the solution is you need to do it manually. Just copy your GoogleService-Info.plist from your root folder then go to platforms/ios/project-name/Resources and paste it there and then there is another Resources folder in it paste it there too. platforms/ios/project-name/Resources/Resources

Then again try to make a build or run it in simulator and it'll be working fine.

Black Mamba
  • 13,632
  • 6
  • 82
  • 105
2

Possibly your GoogleService-Info.plist file is corrupted. Please redownload and replace it.

original discussion here - Firebase for Cordova

Hope this helps...

digiwizkid
  • 791
  • 2
  • 14
  • 28
1

Also, when you use the below method,

FirebaseApp.configure(name:userName , options: .init(googleAppID: ConfigValues.Firebase.googleAppID, gcmSenderID: ConfigValues.Firebase.gcmSenderID))

make sure you give the proper googleAppID and gcmSenderID, to avoid the similar crash.

cnu
  • 443
  • 4
  • 9
0

Please redownload GoogleService-Info.plist file from firebase and replace in your project. This solved my issue.

Ashish
  • 706
  • 8
  • 22
0

If you are initializing firebase like this

  await Firebase.initializeApp(
  name: "AppName",
  options: FirebaseOptions(
      apiKey: "XXXXXX_XXX3VeDOXXDXXXwR8",
      authDomain: "myApp.com",
      databaseURL:
          "https://myapp.firebasedatabase.app",
      projectId: "My_App",
      storageBucket: "my-app-station.com",
      messagingSenderId: "39847398285093",
      appId: "1:439hiojfiojh84394f3j8j943",
      measurementId: "G-4489KDJJHF94"),
);

update it to this

  await Firebase.initializeApp();

No need to explicitly mention all fields as per new docs Answer may vary for Flutter Web

ARAB KUMAR
  • 86
  • 1
  • 8