title: html 5 geolocation in UIWebview iOS 9
body: <p>I've been unable to find a solution to this, on my website I'm loading in a Webview I have the following javascript function that is run after the page finishes loading:</p>
  
  <pre><code>var latitude, longitude, accuracy;
  
  function setGeolocation() {
      accuracy = 5000;
      var geolocation = window.navigator.geolocation.watchPosition( 
          function ( position ) {
              if (position.coords.accuracy &lt; accuracy){
                  latitude = position.coords.latitude;
                  longitude = position.coords.longitude;
                  accuracy = position.coords.accuracy;
  
                  loc = latitude + "," + longitude;
             }
              if (accuracy &lt; 50) window.navigator.geolocation.clearWatch( geolocation );
          },
          function () { /*error*/ }, {
              maximumAge: 250, 
              enableHighAccuracy: true
          } 
      );
  
      window.setTimeout( function () {
              window.navigator.geolocation.clearWatch( geolocation );
          }, 5000 //stop checking after 5 seconds
      );
  };
  </code></pre>
  
  <p>I've added the following to my Plist file:</p>
  
  <ul>
  <li>Privacy - Location Usage Description</li>
  <li>NSLocationAlwaysUsageDescription</li>
  <li>NSLocationWhenInUseUsageDescription </li>
  </ul>
  
  <p>And imported CoreLocation.Framwork</p>
  
  <p>Any ideas why this doesn't work?</p>