Try this instead:
- (void)startDeviceMotionUpdatesUsingReferenceFrame:(CMAttitudeReferenceFrame)referenceFrame
toQueue:(NSOperationQueue *)queue
withHandler:(CMDeviceMotionHandler)handler
with any of:
CMAttitudeReferenceFrameXArbitraryCorrectedZVertical
CMAttitudeReferenceFrameXMagneticNorthZVertical
CMAttitudeReferenceFrameXTrueNorthZVertical
but not:
CMAttitudeReferenceFrameXArbitraryZVertical
(another SO question you missed:CoreMotion - magneticField is always 0)
if you want too much information on magnetometer data, see my answer to this question:In iOS, what is the difference between the Magnetic Field values from the Core Location and Core Motion frameworks?