How to remove cllocation cache?

I am developing an application for the iPhone, which is a location-oriented application. Currently, the application works just fine, except for caching the previous location. The first time I start the application’s location manager, it selects the current location, and then I show the neighboring things based on the current location.

But from the following, it uses the previously selected location and until I restart the phone, it will receive the same location. Therefore, so far I understand that the location manager caches the location.

So my question is how to remove this cache and get the location manager to get a new location thanks

+3
source share
1 answer

Actually, I don’t think you can: it’s for you (in your instance CLLocationManagerDelegate) to filter the position you get based on its timestamp (to make sure that the position you are working in is the last one, not the cached one )

<CODE>

- (void) locationManager: (CLLocationManager *) manager didUpdateToLocation: (CLLocation *) newLocation fromLocation: (CLLocation *) oldLocation {NSDate * eventDate = newLocation.timestamp; NSTimeInterval howRecent = [eventDate timeIntervalSinceNow]; // Is the event the last and accurate enough? if (abs (howRecent) <SECS_OLD_MAX) {// WORK WITH THIS! } .... ....

+7

All Articles