views:

26

answers:

1

Indoors on an iPhone 4. WiFi disabled

Running the LocateMe SDK sample or my own code for 30-60 seconds produces horizontal accuracy of 2294 meters. Pretty inaccurate but reasonable for cell tower triangulation. Looking at other apps that do reverse geocoding or location stuff like Foursquare shows a similar lack of accuracy.

However, if I switch over to another view in my app that uses Mapkit and check/display the user location it is spot on. I mean to the house level accurate on the map which I would associate with WiFi level location or a strong GPS read.

So I figured that Mapkit is likely relying on a cached location read that was derived when WiFi was enabled on my device. I turned off location services in settings. Restarted the Map app moved the map away from my current location. Exit Re-enabled location services. Open Map app again - bingo right back with the strong location read.

As far as I know the Location Service is system level singleton meaning the same data is shared with MapKit as with my CLLocationManager instance. The only thing I can think of is the location is being cached more liberally on MapKit and turning off location services doesn't clear it's cache even when map.app is started.

Is anyone aware of a way to check the age of the user location in MapKit? I'd like to investigate further and even if it's an undocumented call or property I can't ship with I'd really like to use it for debugging to understand what is going on.

Thanks

+1  A: 

You can access the timestamp of the user's location used by a webView as follows:

[[[mapView userLocation] location] timestamp];

The timestamp is an NSDate and it tells you when this location was determined.

muffix