I have a map view defined in IB, and it is set to display the location of the user.
In my application, at -viewDidAppear, I request self.mapView.userLocation.location.coordinate and returns with crazy values, such as:
Latitude: 4.8194501961644877e-49
Longitude: 2.2993313035571993e-59
However, the next time -viewDidAppear is called (after I just switched to another tabbed view and then back to that), the userLocation property contains exactly the right values for my current location.
It appears that the userLocation property was not initialized during my initial call, but even though I read the Apple documentation, I don’t see any caveats saying that this property only works after xxx is executed.
Is there something that needs to happen before userLocation is valid for use, or should I just use the CLLocationManager and ask it instead?
Thanks in advance for your help.
Unfortunately, Thomas's suggestion did not help. Since then I have discovered the following:
If showUserLocation is not, then userLocation is never set correctly and -MapView: didUpdateUserLocation: is never called, so I never get a reasonable location value.
, , showUserLocation YES, , , ( ), , . , , , ! , . Aaargh!
, showUserLocation YES, -MapView: didUpdateUserLocation:, , , !