Cordova-plugin-firebase: The default Firebase app has not yet been configured. Add [FIRApp configure] (FirebaseApp.configure() in Swift)

Created on 21 Sep 2018  ·  34Comments  ·  Source: arnesson/cordova-plugin-firebase

5.7.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. Read more: https://goo.gl/ctyzm8.

Tried several solutions but can't get it to work on iOS 12. From new blank App to being sure Google...plist is on both resource folders and it has the right content.

Also tried Legacy publish on Xcode.

@2.0.2

runtime iOS

Most helpful comment

I was able to fix this.
For some reason Firebase config is not getting the plist file.
I could create a new PR but I unsure if there are any implications on the default FIRApp.

on XCode, open:
/Plugins/AppDelegate+FirebasePlugin.m

comment this block:

if (![FIRApp defaultApp]) {
    [FIRApp configure];
}

add this in its place:

// Get the path for Google-Service-Info.plist
NSString * filePath =[[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType: @"plist"];

// Init FIRApp passing the file
FIROptions * options =[[FIROptions alloc] initWithContentsOfFile: filePath];
[FIRApp configureWithOptions: options];

All 34 comments

@chrisid have you tried to deploy the same application on a different version of iOS? I wanted to confirm it was indeed an iOS 12 issue and not something else.

@briantq good point and your suspicions are right, just tried on an 11.2 iOS device and still got the same issue.

@chrisid Have you gotten the project to work previously? Can you also run cordova plugin list and paste the output.

@briantq yes, it was working before updating to Xcode 10 (maybe that's a lead?)

This happens on an ionic project (plugins below) as well as on a brand new and empty cordova project, that only has firebase as a plugin.

Both

Ionic plugins:
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-facebook4 2.2.0 "Facebook Connect"
cordova-plugin-filechooser 1.0.1 "File Chooser"
cordova-plugin-firebase 2.0.2 "Google Firebase Plugin"
cordova-plugin-ionic-keyboard 2.1.2 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 1.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-whitelist 1.3.3 "Whitelist"
ionic-plugin-deeplinks 1.0.17 "Ionic Deeplink Plugin"

cordova plugins
cordova-plugin-firebase 2.0.2 "Google Firebase Plugin"

cordova: 8.0.0
cordova-ios 4.5.4

@chrisid that could be. I have not tried it on XCode 10. I haven't seen anything for Firebase on iOS when using XCode 10, have you? If you find anything XCode 10 specific, we should definitely make that change. We can see if others encounter similar problems.

Any specific iOS 12 issues are likely on the firebase team to fix and we
would need to upgrade the SDK once those fixes are made.

On Sun, Sep 23, 2018, 6:52 PM Brian Bauman notifications@github.com wrote:

@chrisid https://github.com/chrisid that could be. I have not tried it
on XCode 10. I haven't seen anything for Firebase on iOS when using XCode
10, have you? If you find anything XCode 10 specific, we should definitely
make that change. We can see if others encounter similar problems.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/arnesson/cordova-plugin-firebase/issues/866#issuecomment-423864389,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AKZWKwO7v2PNszRxGNnDdnjqdWXf8uTiks5ueDr3gaJpZM4W0z4V
.

I am having the same problem on a fresh Cordova project with only the firebase plugin installed. Running iOS 12

Same to me. All was working until I update to V2.X.X. Downgrading to V1 doesn't work anymore :(

Blank new Cordova doesn't work using V1 or V2.
ionic project does not work anymore as well.

@soumak77 @chrisid I'm having the same issue and I am on Xcode 9.

Hi, im having the same issue, Xcode 9.4.1
5.7.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. Read more: https://goo.gl/ctyzm8.

@alex87campbell Make sure you are using v2.0.2 as there were issues with the 2.0.0 release that caused this issue.

@alex87campbell @franciscomontiel can you run cordova plugin list, that would help us rule out the issue we had in early 2.0.X releases.

@briantq I'm using 2.0.2.

For cordova
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-firebase 2.0.2 "Google Firebase Plugin"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-whitelist 1.3.3 "Whitelist"

Fo my Ionic
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-firebase 2.0.2 "Google Firebase Plugin"
cordova-plugin-ionic-keyboard 2.1.2 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 1.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-firebase 2.0.2 "Google Firebase Plugin"
cordova-plugin-google-analytics 1.9.0

same problem here
[Firebase/Core][I-COR000003] The default Firebase app has not yet been configured.

cordova plugin ls
cordova-plugin-firebase 2.0.2 "Google Firebase Plugin"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"

@chrisid @dneckel Can you guys post the projects you were using to test? Might be helpful to others to be able to reproduce it.

Same problem here

card.io.cordova.mobilesdk 2.1.0 "CardIO"
com.paypal.cordova.mobilesdk 3.5.0 "PayPalMobile"
cordova-android-support-gradle-release 1.4.4 "cordova-android-support-gradle-release"
cordova-custom-config 5.0.2 "cordova-custom-config"
cordova-plugin-crypt-file 1.3.3 "CordovaCrypt"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-email 1.2.7 "EmailComposer"
cordova-plugin-firebase 2.0.2 "Google Firebase Plugin"
cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"

@briantq I'm just creating a new fresh project every time I test it, nothing added, literally:

  • cordova create fire
  • cordova plugin add cordova-plugin-firebase
  • cordova platform add ios

adding my Google-Service.plist and Xcode testing... nothing more, as I want to be sure there's nothing else causing trouble.

I'm not any good in Obj-C, but I guess the problem happens at:
AppDelegate+FirebasePlugin.m -> [FIRApp configure]

@briantq Sure, thanks for the response.
This is the plugin list:
cordova-android-support-gradle-release 1.4.4 "cordova-android-support-gradle-release"
cordova-custom-config 5.0.2 "cordova-custom-config"
cordova-plugin-advanced-http 1.11.1 "Advanced HTTP plugin"
cordova-plugin-app-preferences 0.99.4 "AppPreferences"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-filepath 1.4.2 "cordova-plugin-filepath"
cordova-plugin-firebase 2.0.2 "Google Firebase Plugin"
cordova-plugin-ionic-keyboard 2.1.2 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 2.1.0 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-telerik-imagepicker 2.2.2 "ImagePicker"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sqlite-storage 2.4.0 "Cordova sqlite storage plugin"
cordova-support-google-services 1.2.1 "cordova-support-google-services"

It is working very good on android.
Im also trying on a new project and same result.

I enabled -FIRDebugEnabled and got this:

PS: I'm sure and double checked Bundle ID everywhere, they all match, my guess is that FIRApp config is not reading Google....plist

Does anyone know if there's a way to NSLog the Google....plist content being used for config?

5.7.0 - [Firebase/Core][I-COR000008] The project's Bundle ID is inconsistent with either the Bundle ID in 'GoogleService-Info.plist', or the Bundle ID in the options if you are using a customized options. To ensure that everything can be configured correctly, you may need to make the Bundle IDs consistent.

I was able to fix this.
For some reason Firebase config is not getting the plist file.
I could create a new PR but I unsure if there are any implications on the default FIRApp.

on XCode, open:
/Plugins/AppDelegate+FirebasePlugin.m

comment this block:

if (![FIRApp defaultApp]) {
    [FIRApp configure];
}

add this in its place:

// Get the path for Google-Service-Info.plist
NSString * filePath =[[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType: @"plist"];

// Init FIRApp passing the file
FIROptions * options =[[FIROptions alloc] initWithContentsOfFile: filePath];
[FIRApp configureWithOptions: options];

@chrisid That error is gone!

But does the notifications work for you? My device doesnt show sign of receiving any.
Do you use a APN certificate for the push notifications?

@chrisid thanks a lot, that worked for me :)

@franciscomontiel yes it's all back working for me.
I use the new .p8 key (Apple dev > "Certificates, Identifiers & Profiles", there's a "Keys" at the left side menu, create one, download and upload to: Firebase console > Project Settings > Cloud Messaging > iOS app Configuration > APNs Authentication Key

@chrisid please create a PR. See the Contribution Guidelines if you have any questions on how to do so. That way we can review the change to see if there are any impacts and talk about alternatives. With the number of people having issues resolved with the change, we should definitely see what we can do sooner rather than later

@franciscomontiel yes it's all back working for me.
I use the new .p8 key (Apple dev > "Certificates, Identifiers & Profiles", there's a "Keys" at the left side menu, create one, download and upload to: Firebase console > Project Settings > Cloud Messaging > iOS app Configuration > APNs Authentication Key

Thanks! It is working now!

Hey!

Just chiming in here to say that I'm running iOS 12 and the latest XCode, 2.0.2 of the plugin, the .p8 key instead of a certificate, and still get the configuration issue. My app starts as usual and I can get a token, but all requests to e.g. subscribe to a topic fails.

Any notification I send from Firebase to the specific token also fails saying the token is unregistered.

I unfortunately can't share my project but would gladly share more info if needed.

@wiwofone that was happening to me as well, I've just sent a PR that should fix that, meanwhile try this: https://github.com/arnesson/cordova-plugin-firebase/issues/866#issuecomment-424746635

For those encountering this issue, you can test PR #880 directly instead of making manual changes yourself by following the steps in our contributing doc

I have applied the fix but now another problem is jumping: 5.7.0 - [Firebase/Messaging][I-FCM002023] The object does not respond to -messaging:didReceiveRegistrationToken:. Please implement -messaging:didReceiveRegistrationToken: to be provided with an FCM token

Although I get the same error as @txikitin (unsure why), the fix @chrisid provided worked for me!

fix available in v2.0.4

Still have the below errors at runtime after installed v2.0.4

0 0x000000010c7d49ca in __38+[FIRAnalytics createAppDelegateProxy]_block_invoke ()

0 0x000000010c7d2889 in FIRAIsAppActive ()

Failed to create remote object proxy: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated.}

cordova plugin list
call-number 0.0.2 "Cordova Call Number Plugin"
cordova-android-support-gradle-release 1.4.4 "cordova-android-support-gradle-release"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-console 1.1.0 "Console"
cordova-plugin-device 1.1.7 "Device"
cordova-plugin-fcm-with-dependecy-updated 2.2.4 "Cordova FCM Push Plugin"
cordova-plugin-firebase 2.0.4 "Google Firebase Plugin"
cordova-plugin-google-analytics 1.8.6 "Google Universal Analytics Plugin"
cordova-plugin-googleplus 5.3.1 "Google SignIn"
cordova-plugin-inappbrowser 2.0.2 "InAppBrowser"
cordova-plugin-splashscreen 4.1.0 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-socialsharing 5.4.1 "SocialSharing"
cordova-support-google-services 1.2.1 "cordova-support-google-services"
es6-promise-plugin 4.2.2 "Promise"
ionic-plugin-keyboard 2.2.1 "Keyboard"

Cheers @soumak77 !

I am now getting the following on each subscription/unsubscription request to a topic:
Invalid registration response Error=INVALID_PARAMETERS

I'm investigating if this is related. Probably not, but putting it out here in case someone else sees the same.

EDIT:
Actually, my device is not registering at all anymore (can't even send from the Firebase Console to the device ID that I get due to "Unregistered device token").

Checked latest lib version with this PR and it works in iOS 12, the notifications are received.

I was follow the @chrisid solution's but with one difference: I modified the file PushPlugin.m in Xcode (project_name/plugins/PushPlugin.m). Here I added in line 303 the next code

FIROptions * options =[[FIROptions alloc] initWithContentsOfFile: path];
[FIRApp configureWithOptions: options];

screen shot 2018-10-11 at 12 00 37 pm

thanks @chrisid
My project is made in ionic/ios

Ionic:

ionic (Ionic CLI) : 4.2.1 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.0

Cordova:

cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.1.0, ios 4.5.5
Cordova Plugins : no whitelisted plugins (24 plugins total)

System:

Android SDK Tools : 26.1.1 (/Users/semillacuerna/Library/Android/sdk)
ios-deploy : 2.0.0
NodeJS : v8.11.3 (/usr/local/bin/node)
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 10.0 Build version 10A255

For me is working with v2.0.4. Remember about Xcode 10 issue
ionic cordova run ios -- --buildFlag="-UseModernBuildSystem=0"

And remember to run it from the command line and not using XCode to run it on the device since the new build system will be applied.

Was this page helpful?
0 / 5 - 0 ratings