firebase instance not loading in cordova ios application










0














I am trying to initialize firebase app in my cordova application. But when I run the app in ios emulator it is not able to load the firebase instance and hence I am not able to access the firebase apis to connect to realtime databse.
Below is my config.xml:



<?xml version='1.0' encoding='utf-8'?>
<widget id="services.hub" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloWorld</name>
<description>
A sample Apache Cordova application
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<universal-links>
<host name="dsdss" scheme="https" />
<host name="sdasdsa" scheme="https">
<path url="/__/auth/callback" />
</host>
</universal-links>
<plugin name="cordova-plugin-whitelist" spec="1" />
<allow-intent href="*" />
<allow-navigation href="*" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<plugin name="cordova-plugin-buildinfo" spec="2.0.2" />
<plugin name="cordova-universal-links-plugin" spec="~1.2.1" />
<plugin name="cordova-plugin-browsertab" spec="0.2.0" />
<plugin name="cordova-plugin-customurlscheme" spec="4.3.0">
<variable name="URL_SCHEME" value="services.hub" />
</plugin>
<plugin name="cordova-plugin-inappbrowser" spec="3.0.0" />
<engine name="ios" spec="^4.5.5" />
</widget>


My Index.html



 <!DOCTYPE html>

<html>
<head>
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<link rel="stylesheet" type="text/css" href="css/index.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script

src="https://www.gstatic.com/firebasejs/4.2.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/4.2.0/firebase-auth.js"></script>
<script>
"use strict";
// Show errors to user.
window.onerror = function(msg, url, line, col, error)
var msgFull = "Error: " + msg + "nurl: " + url + "nline: " + line;
alert(msgFull);
;

// Initialize Firebase
var config =
apiKey: "dcsdcdscsdc",
authDomain: "dsadasd",
databaseURL: "saasdsda",
projectId: "dcssca",
storageBucket: "",
messagingSenderId: "132122"
;
firebase.initializeApp(config);
console.log("Initializing firebase from script tag");
console.log(firebase);
</script>
<title>Hello World</title>
</head>
<body>
<div class="app">
<h1>Firebase Testing</h1>
<div>
<input id="emailid" type="email"/>
</div>
<div>
<input id="password" type="password"/>
</div>
<button onclick="login()">Login</button>

</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</body>
</html>


JavaScript code snippet:



 var app = 
// Application Constructor
initialize: function()
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
,

// deviceready Event Handler
//
// Bind any cordova events here. Common events are:
// 'pause', 'resume', etc.
onDeviceReady: function()
this.receivedEvent('deviceready');
,

// Update DOM on a Received Event
receivedEvent: function(id)
console.log('Device is ready');
try
if(firebase)
console.log('Firebase Initialized: ');
else
console.log('Firebase NOT VAILABLE');

catch(error)
console.log(error.message);


;


When I run the application, it always goes to catch block and always gives the error "firebase instance not found"



I have downloaded the plist file and placed in the location too.
Not sure why firebase instance is not found.










share|improve this question




























    0














    I am trying to initialize firebase app in my cordova application. But when I run the app in ios emulator it is not able to load the firebase instance and hence I am not able to access the firebase apis to connect to realtime databse.
    Below is my config.xml:



    <?xml version='1.0' encoding='utf-8'?>
    <widget id="services.hub" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>HelloWorld</name>
    <description>
    A sample Apache Cordova application
    </description>
    <author email="dev@cordova.apache.org" href="http://cordova.io">
    Apache Cordova Team
    </author>
    <content src="index.html" />
    <universal-links>
    <host name="dsdss" scheme="https" />
    <host name="sdasdsa" scheme="https">
    <path url="/__/auth/callback" />
    </host>
    </universal-links>
    <plugin name="cordova-plugin-whitelist" spec="1" />
    <allow-intent href="*" />
    <allow-navigation href="*" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
    <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
    </platform>
    <plugin name="cordova-plugin-buildinfo" spec="2.0.2" />
    <plugin name="cordova-universal-links-plugin" spec="~1.2.1" />
    <plugin name="cordova-plugin-browsertab" spec="0.2.0" />
    <plugin name="cordova-plugin-customurlscheme" spec="4.3.0">
    <variable name="URL_SCHEME" value="services.hub" />
    </plugin>
    <plugin name="cordova-plugin-inappbrowser" spec="3.0.0" />
    <engine name="ios" spec="^4.5.5" />
    </widget>


    My Index.html



     <!DOCTYPE html>

    <html>
    <head>
    <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
    <meta name="format-detection" content="telephone=no">
    <meta name="msapplication-tap-highlight" content="no">
    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
    <link rel="stylesheet" type="text/css" href="css/index.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script

    src="https://www.gstatic.com/firebasejs/4.2.0/firebase-app.js"></script>
    <script src="https://www.gstatic.com/firebasejs/4.2.0/firebase-auth.js"></script>
    <script>
    "use strict";
    // Show errors to user.
    window.onerror = function(msg, url, line, col, error)
    var msgFull = "Error: " + msg + "nurl: " + url + "nline: " + line;
    alert(msgFull);
    ;

    // Initialize Firebase
    var config =
    apiKey: "dcsdcdscsdc",
    authDomain: "dsadasd",
    databaseURL: "saasdsda",
    projectId: "dcssca",
    storageBucket: "",
    messagingSenderId: "132122"
    ;
    firebase.initializeApp(config);
    console.log("Initializing firebase from script tag");
    console.log(firebase);
    </script>
    <title>Hello World</title>
    </head>
    <body>
    <div class="app">
    <h1>Firebase Testing</h1>
    <div>
    <input id="emailid" type="email"/>
    </div>
    <div>
    <input id="password" type="password"/>
    </div>
    <button onclick="login()">Login</button>

    </div>
    <script type="text/javascript" src="cordova.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
    </body>
    </html>


    JavaScript code snippet:



     var app = 
    // Application Constructor
    initialize: function()
    document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
    ,

    // deviceready Event Handler
    //
    // Bind any cordova events here. Common events are:
    // 'pause', 'resume', etc.
    onDeviceReady: function()
    this.receivedEvent('deviceready');
    ,

    // Update DOM on a Received Event
    receivedEvent: function(id)
    console.log('Device is ready');
    try
    if(firebase)
    console.log('Firebase Initialized: ');
    else
    console.log('Firebase NOT VAILABLE');

    catch(error)
    console.log(error.message);


    ;


    When I run the application, it always goes to catch block and always gives the error "firebase instance not found"



    I have downloaded the plist file and placed in the location too.
    Not sure why firebase instance is not found.










    share|improve this question


























      0












      0








      0







      I am trying to initialize firebase app in my cordova application. But when I run the app in ios emulator it is not able to load the firebase instance and hence I am not able to access the firebase apis to connect to realtime databse.
      Below is my config.xml:



      <?xml version='1.0' encoding='utf-8'?>
      <widget id="services.hub" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
      <name>HelloWorld</name>
      <description>
      A sample Apache Cordova application
      </description>
      <author email="dev@cordova.apache.org" href="http://cordova.io">
      Apache Cordova Team
      </author>
      <content src="index.html" />
      <universal-links>
      <host name="dsdss" scheme="https" />
      <host name="sdasdsa" scheme="https">
      <path url="/__/auth/callback" />
      </host>
      </universal-links>
      <plugin name="cordova-plugin-whitelist" spec="1" />
      <allow-intent href="*" />
      <allow-navigation href="*" />
      <access origin="*" />
      <allow-intent href="http://*/*" />
      <allow-intent href="https://*/*" />
      <allow-intent href="tel:*" />
      <allow-intent href="sms:*" />
      <allow-intent href="mailto:*" />
      <allow-intent href="geo:*" />
      <platform name="android">
      <allow-intent href="market:*" />
      </platform>
      <platform name="ios">
      <allow-intent href="itms:*" />
      <allow-intent href="itms-apps:*" />
      </platform>
      <plugin name="cordova-plugin-buildinfo" spec="2.0.2" />
      <plugin name="cordova-universal-links-plugin" spec="~1.2.1" />
      <plugin name="cordova-plugin-browsertab" spec="0.2.0" />
      <plugin name="cordova-plugin-customurlscheme" spec="4.3.0">
      <variable name="URL_SCHEME" value="services.hub" />
      </plugin>
      <plugin name="cordova-plugin-inappbrowser" spec="3.0.0" />
      <engine name="ios" spec="^4.5.5" />
      </widget>


      My Index.html



       <!DOCTYPE html>

      <html>
      <head>
      <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
      <meta name="format-detection" content="telephone=no">
      <meta name="msapplication-tap-highlight" content="no">
      <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
      <link rel="stylesheet" type="text/css" href="css/index.css">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
      <script

      src="https://www.gstatic.com/firebasejs/4.2.0/firebase-app.js"></script>
      <script src="https://www.gstatic.com/firebasejs/4.2.0/firebase-auth.js"></script>
      <script>
      "use strict";
      // Show errors to user.
      window.onerror = function(msg, url, line, col, error)
      var msgFull = "Error: " + msg + "nurl: " + url + "nline: " + line;
      alert(msgFull);
      ;

      // Initialize Firebase
      var config =
      apiKey: "dcsdcdscsdc",
      authDomain: "dsadasd",
      databaseURL: "saasdsda",
      projectId: "dcssca",
      storageBucket: "",
      messagingSenderId: "132122"
      ;
      firebase.initializeApp(config);
      console.log("Initializing firebase from script tag");
      console.log(firebase);
      </script>
      <title>Hello World</title>
      </head>
      <body>
      <div class="app">
      <h1>Firebase Testing</h1>
      <div>
      <input id="emailid" type="email"/>
      </div>
      <div>
      <input id="password" type="password"/>
      </div>
      <button onclick="login()">Login</button>

      </div>
      <script type="text/javascript" src="cordova.js"></script>
      <script type="text/javascript" src="js/index.js"></script>
      </body>
      </html>


      JavaScript code snippet:



       var app = 
      // Application Constructor
      initialize: function()
      document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
      ,

      // deviceready Event Handler
      //
      // Bind any cordova events here. Common events are:
      // 'pause', 'resume', etc.
      onDeviceReady: function()
      this.receivedEvent('deviceready');
      ,

      // Update DOM on a Received Event
      receivedEvent: function(id)
      console.log('Device is ready');
      try
      if(firebase)
      console.log('Firebase Initialized: ');
      else
      console.log('Firebase NOT VAILABLE');

      catch(error)
      console.log(error.message);


      ;


      When I run the application, it always goes to catch block and always gives the error "firebase instance not found"



      I have downloaded the plist file and placed in the location too.
      Not sure why firebase instance is not found.










      share|improve this question















      I am trying to initialize firebase app in my cordova application. But when I run the app in ios emulator it is not able to load the firebase instance and hence I am not able to access the firebase apis to connect to realtime databse.
      Below is my config.xml:



      <?xml version='1.0' encoding='utf-8'?>
      <widget id="services.hub" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
      <name>HelloWorld</name>
      <description>
      A sample Apache Cordova application
      </description>
      <author email="dev@cordova.apache.org" href="http://cordova.io">
      Apache Cordova Team
      </author>
      <content src="index.html" />
      <universal-links>
      <host name="dsdss" scheme="https" />
      <host name="sdasdsa" scheme="https">
      <path url="/__/auth/callback" />
      </host>
      </universal-links>
      <plugin name="cordova-plugin-whitelist" spec="1" />
      <allow-intent href="*" />
      <allow-navigation href="*" />
      <access origin="*" />
      <allow-intent href="http://*/*" />
      <allow-intent href="https://*/*" />
      <allow-intent href="tel:*" />
      <allow-intent href="sms:*" />
      <allow-intent href="mailto:*" />
      <allow-intent href="geo:*" />
      <platform name="android">
      <allow-intent href="market:*" />
      </platform>
      <platform name="ios">
      <allow-intent href="itms:*" />
      <allow-intent href="itms-apps:*" />
      </platform>
      <plugin name="cordova-plugin-buildinfo" spec="2.0.2" />
      <plugin name="cordova-universal-links-plugin" spec="~1.2.1" />
      <plugin name="cordova-plugin-browsertab" spec="0.2.0" />
      <plugin name="cordova-plugin-customurlscheme" spec="4.3.0">
      <variable name="URL_SCHEME" value="services.hub" />
      </plugin>
      <plugin name="cordova-plugin-inappbrowser" spec="3.0.0" />
      <engine name="ios" spec="^4.5.5" />
      </widget>


      My Index.html



       <!DOCTYPE html>

      <html>
      <head>
      <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
      <meta name="format-detection" content="telephone=no">
      <meta name="msapplication-tap-highlight" content="no">
      <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
      <link rel="stylesheet" type="text/css" href="css/index.css">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
      <script

      src="https://www.gstatic.com/firebasejs/4.2.0/firebase-app.js"></script>
      <script src="https://www.gstatic.com/firebasejs/4.2.0/firebase-auth.js"></script>
      <script>
      "use strict";
      // Show errors to user.
      window.onerror = function(msg, url, line, col, error)
      var msgFull = "Error: " + msg + "nurl: " + url + "nline: " + line;
      alert(msgFull);
      ;

      // Initialize Firebase
      var config =
      apiKey: "dcsdcdscsdc",
      authDomain: "dsadasd",
      databaseURL: "saasdsda",
      projectId: "dcssca",
      storageBucket: "",
      messagingSenderId: "132122"
      ;
      firebase.initializeApp(config);
      console.log("Initializing firebase from script tag");
      console.log(firebase);
      </script>
      <title>Hello World</title>
      </head>
      <body>
      <div class="app">
      <h1>Firebase Testing</h1>
      <div>
      <input id="emailid" type="email"/>
      </div>
      <div>
      <input id="password" type="password"/>
      </div>
      <button onclick="login()">Login</button>

      </div>
      <script type="text/javascript" src="cordova.js"></script>
      <script type="text/javascript" src="js/index.js"></script>
      </body>
      </html>


      JavaScript code snippet:



       var app = 
      // Application Constructor
      initialize: function()
      document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
      ,

      // deviceready Event Handler
      //
      // Bind any cordova events here. Common events are:
      // 'pause', 'resume', etc.
      onDeviceReady: function()
      this.receivedEvent('deviceready');
      ,

      // Update DOM on a Received Event
      receivedEvent: function(id)
      console.log('Device is ready');
      try
      if(firebase)
      console.log('Firebase Initialized: ');
      else
      console.log('Firebase NOT VAILABLE');

      catch(error)
      console.log(error.message);


      ;


      When I run the application, it always goes to catch block and always gives the error "firebase instance not found"



      I have downloaded the plist file and placed in the location too.
      Not sure why firebase instance is not found.







      javascript firebase firebase-realtime-database






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 9 at 21:37









      Frank van Puffelen

      226k27368395




      226k27368395










      asked Nov 9 at 21:20









      Vijayendra Gade

      697




      697



























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233411%2ffirebase-instance-not-loading-in-cordova-ios-application%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233411%2ffirebase-instance-not-loading-in-cordova-ios-application%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

          Edmonton

          Crossroads (UK TV series)