Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

locationManager didFailWithError null phonegap simulator

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?

like image 427
mboeckle Avatar asked Nov 08 '12 22:11

mboeckle


2 Answers

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.

like image 99
A_B Avatar answered Sep 26 '22 10:09

A_B


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.

like image 23
Robert-W Avatar answered Sep 25 '22 10:09

Robert-W