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();
}