I have two ways of getting the magnetic fields (strength, x, y, and z) using the iOS device's magnetometer.

1) Core Location
Used the CLHeading from CLLocationManagerDelegate method locationManager:didUpdateHeading:. This is similar to Apple's Teslameter sample app.

2) Core Motion
Used CMMagneticField from CMMotionManager's magnetometerData.magneticField.

Questions:
a) What is the difference between the two? I am getting different values from both. I was expecting that they will return the same values.
The difference is most notable when I start the app from a resting position (face up in a table), and then lift the device up in to the air.
b) If there is a difference, when should I use the magnetic field from Core Location heading, and when should I use the magnetic field from Core Motion?

Note: I also am not sure if the "magnetic field" of Core Location and Core Motion refer to different magnetic field concepts.
Note: I computed strength as the square root of (x^2 + y^2 + z^2) for both approaches.

Edit
Report