Heading accuracy is coming up negative
I am trying to show compass on my screen
if ([CLLocationManager headingAvailable]) {
CLController.locMgr.headingFilter = 0.1;
[CLController.locMgr startUpdatingHeading];
}
it goes into method, and goes into method
- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading {
if (newHeading.headingAccuracy < 0){
NSLog(@"heading accuracy < 0"开发者_如何学C);
return;
}
// Use the true heading if it is valid.
CLLocationDirection direction = ((newHeading.trueHeading > 0) ?
newHeading.trueHeading : newHeading.magneticHeading);
[self.delegate headingUpdate:direction];
}
Earlier it was working fine, but dont know what happened now,
It's showing "heading accuracy < 0"..
A negative headingAccuracy value simply means that the compass cannot get a good reading at the moment. Perhaps the phone is near some strong magnetic field or you need to wave it in a figure 8 to calibrate the compass. It doesn't mean your code is incorrect.
Just ignore the heading updates where the headingAccuracy < 0, and only use the other values you get. This is normal behaviour.
精彩评论