EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 448 forks source link

Getting error on run #1672

Open Janskiproducer opened 3 years ago

Janskiproducer commented 3 years ago

I have migrated a project to NS7, and getting this error when trying to run in simulator (iOS): Uncaught TypeError: firebase.init is not a function.

In app.js: var firebase = require("@nativescript/firebase");

firebase.init({ // Optionally pass in properties for database, authentication and cloud messaging, // see their respective docs.

iOSEmulatorFlush: true,
showNotifications: false,
autoClearBadge: true,
showNotificationsWhenInForeground: true,

onMessageReceivedCallback: function(message) {
    console.log(message);
      var dialogs = require("tns-core-modules/ui/dialogs");
      dialogs.alert({
          title: message.title,
          message: message.body,
          okButtonText: "OK"
      }).then(function () {
          console.log("Dialog closed!");
      });

  },
  onPushTokenReceivedCallback: function(token) {
      console.log("Firebase push token: " + token);
      appSettings.setString("token",token);
  }

}).then( function () { console.log("firebase.init done"); }, function (error) { console.log("firebase.init error: " + error); } );

PhilippS93 commented 3 years ago

Same here in the emulator JS: ERROR TypeError: g.init is not a function

Mflm commented 3 years ago

Any solution?

peppeg85 commented 3 years ago

no solution for this error? now i've seen this issue, i've posted also here, sorry https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/1700