Build error in ionic capacitor iOS app 'Firebase.h' not found

Hello all,
I’m new to cross platform and mobile dev in general. I am using ionic6 with Angular and Capacitor3.
I am trying to make an app that uses push notifications (with Firebase). I had managed to compile my iOS app once, but on my 2nd attempt it didn’t work although I hadn’t changed anything.
I have followed this documentation

As well as this tutorial (I’ve copied the code from the doc as the tutorial is a little old)

When I build my app, i get this error :

/Users/usr/Documents/my-app/ios/capacitor-cordova-ios-plugins/sources/CordovaPluginFcmWithDependecyUpdated/FCMPlugin.m:8:9: ‘Firebase.h’ file not found with include; use “quotes” instead"

If I change #import <Firebase.h> into #import “Firebase.h” as suggested, then I get his error :

/Users/usr/Documents/my-app/ios/capacitor-cordova-ios-plugins/sources/CordovaPluginFcmWithDependecyUpdated/AppDelegate+FCMPlugin.m:215:7: Use of undeclared identifier ‘FIRInstanceID’

I read somewhere that I only need to comment it since it’s deprecated. Which leads me to this error :

Undefined symbol: OBJC_CLASS$_FIRAnalytics

image

I’ve tried almost everything I could find online but nothing works. I’ve been stuck here for a week now.
Please let me know if you have any leads or if you need more information (preferably how to get it since I’m still new to this, I may not know how to)

Thank you very much in advance !

Hi,

try to run ionic capacitor sync. If it doesn’t fix the problem, reinstall the firebase plugin trough npm and run ionic capacitor sync again.

Hello,

Thank you for your reply.
I had actually tried it already with no success.
I’ve managed to build my app by :

  • commenting the sign causing the 1st error
  • replacing Googleservice-Info.plist in my ios/capacitor-cordova-ios-plugins/resources/ by the same file from ios/App/App These changes were done on node_module cuz otherwise the build will override my changes. I’ll try to find another approach maybe with @capacitor-community/firebase-analytics plugin because my solution doesn’t look too pretty