1

I have an issue with the firebase initialisation on my nativescript app (nativescript-vue). I am using the nativescript-firebase plugin from https://github.com/EddyVerbruggen/nativescript-plugin-firebase
Here is my initialisation:

import { messaging } from "@nativescript/firebase/messaging";
import { firebase } from "@nativescript/firebase"
firebase.init({
    onMessageReceivedCallback: function(message) {
       //do stuff
    }
}).then(function () {
    //do stuff
},function (error) {
  console.log("firebase.init error: " + error);
});

This works fine on android, but on ios, I get the error from my console.log
ReferenceError: FIROptions is not defined

My firebase.nativescript.json file is the following:

{
    "using_ios": true,
    "using_android": true,
    "analytics": true,
    "firestore": false,
    "realtimedb": false,
    "authentication": false,
    "remote_config": false,
    "performance_monitoring": false,
    "external_push_client_only": false,
    "messaging": true,
    "in_app_messaging": false,
    "crashlytics": false,
    "storage": false,
    "functions": false,
    "facebook_auth": false,
    "google_auth": false,
    "admob": false,
    "dynamic_links": false,
    "ml_kit": false
}

I have tried removing and adding the plugin and running ns clean on my project but it didn't change anything.
Another issue I have is that I do not get prompted the questions (the ones that fill up the json file) when I add the plugin. On android I had to go to node_modules/@nativescrpt/firebase and run npm run config to get the questions. However, this command does nothing on ios. I have no error, in my terminal, but nothing happens.

  • Have you checked this issue: https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/923 ? – David Jan 30 '22 at 15:55
  • I have but it didn't help much. The only thing that I haven't tried yet in this post is https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/923#issuecomment-485590194 because I didn't quite understand what he meant, I'll try to dig on that today – Fabrice Ducloux Jan 31 '22 at 09:07
  • Well, adding "Firebase/Core" to my Podfile and running `pod install` didn't change anything for me – Fabrice Ducloux Jan 31 '22 at 13:27
  • I got it to work, running `npm run config` was necessary and it didn't work because I had an old version of npm – Fabrice Ducloux Jan 31 '22 at 13:49

1 Answers1

1

I got it to work, the two issues were indeed linked. I had to run npm run config for the plugin to work correctly.
It turns out I was using an old version of npm. Updating npm and running npm run config again fixed my issue