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.
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