No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Should I report this Cordova bug to github?

    Help
    3
    10
    1950
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ssuess
      ssuess last edited by

      Hi, I can’t get Cordova wrappers/builds to work correctly out of the box (only building for iPhone at the moment), but I have a workaround which DOES allow it to work, and it involves adding code to the index.html file in my dist build folder.

      Here is the code I need to add to index.html every time so that plugins will work:

      <script type=text/javascript src=cordova.js>
      <script type=text/javascript>
      document.addEventListener("deviceready", onDeviceReady, false);
      function onDeviceReady() {
      }</script>
      

      without this, my projects will build, but they won’t use any cordova plugins (like statusbar). Or is there some other trick to getting plugins working in cordova that I am missing? If so, I am all ears.

      1 Reply Last reply Reply Quote 0
      • rstoenescu
        rstoenescu Admin last edited by

        Quasar takes of Cordova integration automatically. It adds that script tag and waits for deviceready event to be triggered (through Quasar.start(...)). You don’t need to manually add this.

        Check the default template.

        1 Reply Last reply Reply Quote 0
        • ssuess
          ssuess last edited by

          Believe me, it will not run properly unless I take this extra step. If I leave it out, and let it build (rather, let quasar build, because it is a result of that process I need to modify) run its course, and then build with what it is using by default, I will not have access to cordova plugin functionality. This results in things like the toolbar crashing into the status bar (which is fixed by a normally working cordova statusbar plugin). So I just added my code to the default index.html file in src, and it works the same way as if I add it after the build, but you seem to indicate this should not be necessary. I have tried a bunch of ways without and it refuses to run properly in cordova builds for ios without it.

          1 Reply Last reply Reply Quote 0
          • ssuess
            ssuess last edited by ssuess

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • ssuess
              ssuess last edited by

              @rstoenescu I would like to revisit and fix this problem. I just re-setup Cordova (quasar wrap cordova) and the problem is the same. it builds fine and plugins work on Android, but on iOS it is necessary to include the Cordova script by hand in the index.html file or plugins will not work. Can you point me to where in the code it is building the iOS part? I notice a few differences between the android and iOS folders in platforms in Cordova tree…for example, the iOS folder contains a www folder at the top level whereas the android folder does not. I am happy to chase down any avenues because I think this is an important bug to fix, but I could use a little guidance. Do you want me to report this bug in Github?

              1 Reply Last reply Reply Quote 0
              • ssuess
                ssuess last edited by

                Some more info: I have also tried removing and re-adding iOS platform, and upgrading iOS platform to 4.5.1 - still have the same problem. Is this a Cordova bug or a Quasar bug? I am not sure…

                1 Reply Last reply Reply Quote 0
                • ssuess
                  ssuess last edited by

                  and more: I have verified that the index.html and three js files (app, manifest and vendor) are identical between their iOS and Android generated versions (in /platforms/ios/www and /platforms/android/assets/www respectively). Also the other files present in each folder seem to match. So at some point when the bundle gets loaded onto my iPhone or simulator, plugins will not work without force including it in the index.html file…

                  1 Reply Last reply Reply Quote 0
                  • ssuess
                    ssuess last edited by ssuess

                    Does really NO ONE ELSE have this problem?!! Is no one building for ios?

                    1 Reply Last reply Reply Quote 0
                    • J
                      jimmack1963 last edited by jimmack1963

                      Hi, I’m no cordova expert, just a long time non-web programmer, but often situations like you describe are related to timing, and although I know you are an accomplished programmer, I’ll write extra to be more helpful to others.

                      If you have time to play with a new blank template, out of the box functionality and the dumbest possible plugin like vibration alone, or whatever, and it doesn’t work, you could post it and rstoenescu might be able to quickly track down why. Also consider it might work for android and then not ios. Of course, as you know, if the simple version does function without your workaround, you then get to try adding each additional plugin back until you find the conflict. 🎰

                      1 Reply Last reply Reply Quote 0
                      • ssuess
                        ssuess last edited by

                        I FINALLY know why this is happening! I am using the ionic supplied plugin cordova-plugin-ionic-webview, because it provides a MUCH faster web view (WKWebview) than the built in one (the quite old UIWebView). But when using this, it does not by default include the reference to cordova.js like the built in one. So while it itself is a plugin and loads, it apparently prevents other plugins from loading. So now I just need to figure out how to get it to automatically include the reference so I don’t have to keep including it by hand.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post