I know there's a similar post about this, but the owner got it working just by reinstalling the plugin, which didn't work for me. Here's what I did:
$ ionic start mySecondApp tabs
$ cd mySecondApp
$ ionic platform add ios
$ cordova plugin add org.apache.cordova.geolocation
$ vim www/js/controller.js
**Insert this code at DashCtrl: **
.controller('DashCtrl', function($scope) {
var onSuccess = function(position) {
var lat = position.coords.latitude;
var lng = position.coords.longitude;
alert(lat +"\n" + lng);
};
// onError Callback receives a PositionError object
//
function onError(error) {
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
}
navigator.geolocation.getCurrentPosition(onSuccess, onError)
})
save it
$ ionic build ios
$ ionic emulate ios
First you will see the proper message that I want saying that your app wants to use your location, fine, then after that you will see this poping up:
Any idea how to fix this? I've tried ngcordova and doesn't work too
The same happens on the emulator
Here's the QR code if you want to use the ionic view
Or just download the project: here