8

I am having following problem with the location service with IOS on the simulator:

using phonegap 2.2.0 with xcode 4.5.2,

Cordova.plist EnableLocation = YES

navigator.geolocation.getCurrentPosition(myPositionSuccess, myPositionError, {maximumAge: 300000, timeout:10000, enableHighAccuracy : true});

myPositionSuccess is never called, with following error at navigator.geolocation

locationManager::didFailWithError (null)

I just tried it on the simulator. Any Idea?

2 Answers 2

9

Exit the simulator & run your app again. Worked for me.

I was having the same error with XCode Version 4.3.2 & cordova/phonegap 2.1.0

The simulator was unable to get my location even when I ran Google Maps in Safari. That led me to the conclusion that it was more than just my project that was at fault.

I am still unable to figure out exactly why restarting the simulator worked, but there is one possible reason.

I usually shut down my Mac without quitting most of my running apps & the "Reopen windows when logging back in" option checked. The simulator, however, is one of the apps i definitely quit. But the last time I shut down, I did not quit it. So, like I said, possible reason.

Hope this helps you.

2
  • This worked for me, too. I just quit the sim and started it again, and it starting working right away. Cheers.
    – Nick M
    Commented Jan 7, 2014 at 0:19
  • This also worked for me, I'm wondering what the issue here is. I'm running on XCode 7.1 and Cordova with Ionic
    – Amaan
    Commented Nov 17, 2015 at 0:24
8

Another thing may be to check the location setting in your simulator, I believe the default setting is none which means the geolocation will not find anything. If you are running your simulator, go to Debug > Location > City Run or some other choice and then try to use the geolocation function again it should work fine.

I know this is a bit old but I was looking for an answer on this when I remembered the location setting so I figured I would post here for future reference in case anyone needs it.

1
  • 1
    This works for me Phonegap 3.3+, Debug -> Location -> City Run, thank you Commented May 21, 2014 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.