CoreLocation trueHeading not accurate

I found iOS CoreLocation trueHeading not accurate. Accutally, it was off a lot. When I point the iPhone to north, it reported a heading of 250 degree. Why?


Here is my code to setup location Manager:


        locationManager.delegate = self
        locationManager.desiredAccuracy = kCLLocationAccuracyBest
        locationManager.requestWhenInUseAuthorization()
        locationManager.startUpdatingLocation()
        locationManager.startUpdatingHeading()


Here is my code to retrieve the heading:

func locationManager(_ manager: CLLocationManager,
                         didUpdateHeading newHeading: CLHeading){
        let heading = newHeading.trueHeading;
        print(heading)
        radarView.heading = Float(heading);
        radarView.setNeedsDisplay();
    }

Hello,


You can query this property (headingAccuracy) to get an idea of how accurate the heading may be at any point.

The bottom line is that you should not rely on 'trueHeading' being perfectly accurate in your application (which I am assuming is some sort of AR navigation app since this is in the ARKit section of the forums.)

The headingAccuracy is 15 degree. The problem is that the device was facing north, which means trueHeading should be 0 degree or 360 degree. But the number showed up was 250 degree. That was 100 degree difference.

I have the same problem - the reported headingAccuracy is less than 20 degrees and it is off with more than 100 degress. It would be nice to know if the bearing to North is bad and pass the information to the user of the app.

CoreLocation trueHeading not accurate
 
 
Q