CLLocationManagerDelegate callback bug

Originator:jonsibley
Number:rdar://13173038 Date Originated:
Status:Open Resolved:
Product:iPhone SDK Product Version:iOS SDK 6.1
Classification:Serious Bug Reproducible:Always
 
Summary:

When the -locationManager:didUpdateToLocation:fromLocation: message is sent to the CLLocationManagerDelegate, newLocation ("to location") is correct, but locationManager.location is incorrect (still contains the old location).

Steps to Reproduce:

1. Download my sample project at https://github.com/sibljon/CoreLocationDidUpdateToLocationBug
2. Run in Simulator
3. Set your location to Apple (Debug->Location->Apple) and observe console
4. Set your location to Germany (Debug->Location->Custom) -- Latitude 51, Longitude 9 -- and observe console
5. Note how when you change the location to Germany:
    newLocation == <+51.00000000,+9.00000000>
    - [CLLocationManager location] == <+33.67879735,-112.62216181>

Expected Results:

The CLLocationManagerDelegate Protocol Reference states that:

"By the time this message is delivered to your delegate, the most recent location data is also available directly from the CLLocationManager object. The newLocation parameter may contain the data that was cached from a previous usage of the location service. You can use the timestamp property of the location object to determine how recent the location data is."

In other words, [CLLocationManager location] should be correct when the -locationManager:didUpdateToLocation:fromLocation: message is sent

NOTE: I also have tested this with -locationManager:didUpdateLocations: (the iOS 6+ preferred callback), and it produces the same stale location.  I left -locationManager:didUpdateLocations: commented out in the example project (JSViewController.m)

Actual Results:

[CLLocationManager location] is not updated when the locationManager:didUpdateToLocation:fromLocation: message is sent.

Regression:

This bug has been observed on the iOS 6.0 and 6.1 Simulators.

Notes:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!