Error with cordova-plugin-firebase

I recently added firebase plugins for push notifications, it worked on Android device
but for iOS device,
I tried to build the ionic cordova app on xcode, and it shows

 WARN: Ionic Native: tried calling Firebase.getToken, but the Firebase plugin is not installed.
WARN: Install the Firebase plugin: 'ionic cordova plugin add cordova-plugin-firebase'


in the console (build succeed, app can run in my device but the function isn’t working)
However this plugin is installed

attempt 1: If I run reinstall the firebase plugin
ionic cordova plugin rm cordova-plugin-firebase
ionic cordova plugin add cordova-plugin-firebase
it shows build error (build failed in Xcode)

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_FIRComponent", referenced from:
      objc-class-ref in FirebaseAuth(FIRAuth.o)
  "_OBJC_CLASS_$_FIRComponentType", referenced from:
      objc-class-ref in FirebaseAuth(FIRAuth.o)
  "_OBJC_CLASS_$_FIRComponentContainer", referenced from:
      objc-class-ref in FirebaseAuth(FIRAuth.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

attempt 2: If I reinstall iOS platform, it will show this error (in the command line)

failed to install 'cordova-plugin-firebase': CordovaError: Uh oh!
File already exists at destination "/platform/ios/myapp/Resources/GoogleService-Info.plist" for resource file specified by plugin cordova-plugin-firebase in iOS platform

ionic info

Ionic:

   ionic (Ionic CLI)  : 4.10.3 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.5.3
   @ionic/app-scripts : 1.3.12

Cordova:

   cordova (Cordova CLI) : 7.1.0
   Cordova Platforms     : ios 4.5.5
   Cordova Plugins       : no whitelisted plugins (29 plugins total)

System:

   Android SDK Tools : 26.1.1 (/usr/local/Caskroom/android-sdk/4333796)
   ios-deploy        : 1.9.4
   NodeJS            : v10.15.1 (/usr/local/bin/node)
   npm               : 6.4.1
   OS                : macOS Mojave
   Xcode             : Xcode 10.1 Build version 10B61

Any help would be greatly appreciated, thank you !

found a solution


it turns out the cordova-plugin-firebase has conflict with phonegap-push

Hi, I solved this problem:

  • Rename the file GoogleService-Info.plist in our root folder to GoogleService-Info.plistxx
  • Remove the file inside your platform/ios/AppName/Resources/GoogleService-Info.plist
  • Run the command ionic cordova plugin add cordova-plugin-firebase
  • Rename the file GoogleService-Info.plistxx in our root folder to GoogleService-Info.plist

=D

1 Like

Thank you! Worked for me :slight_smile:

change path=‘./GoogleService-Info.plist’ in project.pbxproj