views:

27

answers:

0

I have a subtle bug that I'm trying to resolve regarding getting updated locations on the iPhone.

Under "normal" conditions, the heading updates come in perfectly fine from the location manager. However, on reboot of the phone or killing all processes on the phone, the heading does not update properly. I always get a -1 for heading. Once in this state, I can get the heading to update again properly by switching to the compass app and letting the heading calibrate there. Switching back to my app results in the heading being updated perfectly again.

I'm initializing things fairly standardly:

if (locationManager != nil) {

    locationManager.headingFilter = kCLHeadingFilterNone;

    [locationManager startUpdatingHeading];

    locationManager.delegate = self;
}

This is called every time before I launch into the portion of the app that gets the updated heading.