I’m working on a Titanium app (currently targeted for iPhone deployment, but ultimately intended to be cross-platform) that requires me to identify several institution locations and display the distance to each from the phone’s current location. When I try to determine my current location using Titanium’s Ti.Geolocation.getCurrentPosition() API, all I get is this message: Location Services Disabled.
I’m testing in the iPhone simulator and I’ve read conflicting messages about whether location services work in the simulator with Xcode 4.x installed (I’m running 4.2) so I thought I’d ask a wider audience here:
- Should I be able to identify my current position in the simulator using Xcode 4.2?
- If so, what do I need to do to enable location services? I have yet to find anything that works to enable these services.
For whatever it may be worth, here’s the relevant snippet of the code I’m trying to run:
// purpose is required for iPhone 3.2+
Ti.Geolocation.purpose = 'Determine the current distance to each Inova Health System location.';
Ti.Geolocation.getCurrentPosition( function( e ) {
alert( e.coords );
});
Thanks for your help.
With Xcode 4.2 the simulator location service worked again. So yes, you can even set the location. Debug -> Location and there should be a list.
But the message you got looks like the location service might be disabled for your app, go and check the settings app in the simulator and also check on a real device.