Cordova GeoLocation not working on IOS simulator 8 (Version 8.1 (550.3))

Hello guys,

I’ve just migrated to XCode 6, and have installed the iOS simulator via brew: brew install ios-sim, it installed the latest iOS emulator version (Version 8.1 (550.3)) of course, and everything was working well until I tested a part of my app that’s using Cordova GeoLocation (via ng-cordova), I’m doing it like this (and it used to work with the older emulator):

$ionicLoading.show();
$cordovaGeolocation.getCurrentPosition()
.then(function(position) {
  var coordinates = {
    latitude: position.coords.latitude,
    longitude: position.coords.longitude
  };
  return coordinates;
}, function(err) {
  //ERROR
  console.log('Cordova GeoLocation Error ocurred');
}).then(function(coordinates) {
  SearchService.do(term, coordinates, 1).then(function(results) {
    $ionicLoading.hide();
    //do something with search results  
  });
});

Since I’m using $ionicLoading right before I trigger GeoLocation the resulting effect is that the Loading screen never fades away (because the Cordova GeoLocation plugin isn’t working…).
I understand I should even get a request/pop-up for “Allow Location Services to use my location, etc, etc”, but that doesn’t get triggered. The log in /platforms/ios/cordova/console.log doesn’t have any useful information after running either.

Can anyone please help me getting Cordova GeoLocation to work?

Thanks in advance!
-J

I think I had the same issue, but because I didn’t install the cordova plugin.

Try doing:

cordova plugin add org.apache.cordova.geolocation

And see it that helps?

2 Likes

I was experiencing the same problem. This fixed it. Great looking out, @hnphan!

Thank you @hnphan you made my day.