Core Location Framework Issues
I'm writing an application that uses the Core Location framework. It only waits for one call to the delegate, then stops waiting for location updates. My Core Location application was running into problems recently. The latest location update is usually 8 hour old. If I run Google Maps application it acquires the location just fine, then when I load my application it also gets the correct location. Then I noticed the Google Maps application works differently. The circle pulsates, and the location updates continue narrowing down my location.
So I went digging in my code, and I fixed the problem by continuously updating (not calling [manager stopUpdatingLocation];) until the timestamp of the latest location is less than a minute old.
What confuses is me is that no where in the documentation does it say that Core Location will return with an 8 hour old location even if I have my desiredAccuracy set to 1000 kilometers.
The CLLocationManager shouldn't call the delegate if the location is 8 hours old. Or even 30 minutes for that matter. Hopefully this is a bug and will be fixed in future firmware version.


2 Comments:
What you are experiencing is the desired behavior of the system. CLLocationManager is a front for an otherwise singleton backend where locations are stored, retrieved and accessed, by all applications.
In order to achieve what you want you must set the distanceFilter property to kCLDistanceFilterNone, which should update the system if it thinks it has moved.
I believe I read somewhere that stopping and restarting the manager will also cause it to request a new location from HW, but I'm not sure if this is the case, and I haven't tried it.
I actually did that, and it didn't help. I tried a bunch of combinations and still got the same results.
Post a Comment
<< Home