Thank you for your quick reply!
They are both incorrect.
which value (magnetic or true) are you showing as incorrect in your video?
I don't know what value is set to use in the Compass app. But in our app, two values are displayed on the compass: "M:" - magnetic and "T:" - true north. In the video you can see a difference of about 120 degrees between our app (as well as third-party) and the Compass app.
which value (magnetic or true north) is the Compass app set to use? If you are comparing the two, make sure they are displaying the same thing
We use the default value, that is, according to the documentation (https://developer.apple.com/documentation/corelocation/cllocationmanager/headingorientation) this is .portrait
, which corresponds to our expectations.
what is the .headingOrientation
set to for CLLocationManager before you call startUpdatingHeading()?
The device orientation needs to be set correctly for accurate results
We do not correct the heading value based on .headingAccuracy
property.
have you been checking the .headingAccuracy
property of the CLHeading
object to determine if the reported heading is considered accurate or some error is expected. Heading accuracy will depend on factors like GPS location accuracy, the speed of movement, and so on. You may want to correct the heading you are displaying based on this value as well
It was the default value - .other
.
furthermore what have you set the CLLocationManager's .activityType
property? For your use case you would want to set it to .airborne
so the system does not try to make corrections not appropriate to the motion patterns which might occur in the air
.headingAccuracy
property of the CLHeading
class (https://developer.apple.com/documentation/corelocation/clheading/headingaccuracy) is the maximum deviation (measured in degrees) between the reported heading and the true geomagnetic heading.
- With the help of the
CMDeviceMotion
class we get this true geomagnetic heading or not? - Is there a way to just get the same data as the Compass app?
- And also, can we somehow make sure that the problem is on the side of our app (and other third-party ones as well), and not in an iOS / device bug?
Alternatively, you can look into the CMDeviceMotion
class, and obtain heading and magnetic field information using the startDeviceMotionUpdates()
call, and see if the results will be more suitable for your use case.