Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-13531

cordova-geolocation not working when using wkwebview on ios11

    XMLWordPrintableJSON

Details

    • Important

    Description

      I've created two empty cordova projects with latest cordova, cordova-ios and cordova-plugin-geolocation:

      • 1) one uses the default UIWebView
      • 2) other uses WKWebView

      Those are simple starter projects that simply try to get user GPS location.

      When I open project (1) everything is fine, I get the pop-up asking me to allow location access with the message I specify, as expected.
      When I open project (2) I don't get the pop-up and cannot access location information.

      Tested on latest OSX and latest iOS on physical iPhone 6S and iPhone X simulator

      -----------

      To recreate exactly the same conditions:

      • create cordova project
      • install plugins
      • everything is default, except index.js that looks like this:
      var app = {
          initialize: function () {
              document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
          },
          onDeviceReady: function () {
              navigator.geolocation.getCurrentPosition(
                  function (position) { console.info(position); },
                  function (error) { console.error(error); },
                  { timeout: 30000 }
              );
          }
      };
      
      app.initialize();
      

      Attachments

        Activity

          People

            surajpindoria Suraj Pindoria
            andreafdaf Andrea Fernandes da Fonseca
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: