title: In iOS, what is the difference between the Magnetic Field values from the Core Location and Core Motion frameworks?
body: <p>I have two ways of getting the magnetic fields (strength, x, y, and z) using the iOS device's magnetometer.  </p>
  
  <p>1) Core Location<br>
  Used the CLHeading from <code>CLLocationManagerDelegate</code> method <code>locationManager:didUpdateHeading:</code>. This is similar to Apple's Teslameter sample app.  </p>
  
  <p>2) Core Motion<br>
  Used <code>CMMagneticField</code> from <code>CMMotionManager</code>'s <code>magnetometerData.magneticField</code>.  </p>
  
  <p>Questions:<br>
  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.<br>
  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.<br>
  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?</p>
  
  <p>Note: I also am not sure if the "magnetic field" of Core Location and Core Motion refer to different magnetic field concepts.<br>
  Note: I computed strength as the square root of (x^2 + y^2 + z^2) for both approaches.</p>