Cordova geolocation.getCurrentPosition Works in Monaca iPhone Debugger But Not With Built iOS App -


navigator.geolocation.getcurrentposition cordova api method works monaca debugger/ app emulator installed on iphone, freezes in built ios version on same phone.

i added following config.xml didn't fix problem.

<feature name="geolocation">     <param name="ios-package" value="cdvlocation" /> </feature>  

i tried reproduce problem. unfortunately posted less information. set new cordova project:

  1. cordova create geolocationtest com.example.com geolocationtest
  2. cd geolocationtest
  3. cordova platform add ios
  4. cordova plugin add cordova-plugin-geolocation
  5. cordova build

then moved folder , edited index.html. added code:

document.addeventlistener("deviceready", ondeviceready, false); function ondeviceready() {     console.log("navigator.geolocation works well"); } 

after added example geolocation-plugin documentation:

// onsuccess callback // method accepts position object, contains // current gps coordinates // var onsuccess = function(position) {     alert('latitude: '          + position.coords.latitude          + '\n' +           'longitude: '         + position.coords.longitude         + '\n' +           'altitude: '          + position.coords.altitude          + '\n' +           'accuracy: '          + position.coords.accuracy          + '\n' +           'altitude accuracy: ' + position.coords.altitudeaccuracy  + '\n' +           'heading: '           + position.coords.heading           + '\n' +           'speed: '             + position.coords.speed             + '\n' +           'timestamp: '         + position.timestamp                + '\n'); };  // onerror callback receives positionerror object // function onerror(error) {     alert('code: '    + error.code    + '\n' +           'message: ' + error.message + '\n'); }  navigator.geolocation.getcurrentposition(onsuccess, onerror); 

that worked fine me. problem has anywhere in code. should provide more information.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -