Skip to content

Instantly share code, notes, and snippets.

@danpalmer
Created January 16, 2013 12:55
I need to check that I'm not missing something about the details of CoreLocation. I am extending this code, and found this in the CLLocationManagerDelegate. It starts updating *location* and *heading*, then when it receives the *location* it stops updating the *heading* and vice-versa. This seems to be wrong to me, am I misunderstanding somethin…
- (void) locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading {
[manager stopUpdatingLocation];
occurrence.heading = [NSNumber numberWithDouble:[newHeading trueHeading]];
[occurrence didReceiveNewData];
}
- (void) locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
[manager stopUpdatingHeading];
occurrence.lat = [NSNumber numberWithDouble:newLocation.coordinate.latitude];
occurrence.lon = [NSNumber numberWithDouble:newLocation.coordinate.longitude];
occurrence.altitude = [NSNumber numberWithDouble:newLocation.altitude];
occurrence.locationPrecision = [NSNumber numberWithDouble:newLocation.horizontalAccuracy];
occurrence.speed = [NSNumber numberWithDouble:newLocation.speed];
[occurrence didReceiveNewData];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment