I understand that it is not possible to get magnetic heading readings from the CoreLocation framework on an iPod Touch 4G, but it is possible to produce magnetometer readings using the CoreMotion framework.
I also understand that I need to use CMMotionManager
and set the deviceMotionUpdateInterval
to achieve this. I can then start and stop the updates with - (void)startMagnetometerUpdates
and - (void)stopMagnetometerUpdates
respectivley.
Now that I have my raw magnetometer data (x,y,z), how can I use it to achieve a magnetic heading?
I've seen some pretty complicated explanations online but would appreciate a code like example.
EDIT: My mistake, it is not possible to get magnetometer readings on the iPod Touch 4G.
The iPod touch does not have a magnetometer (See apple-devices-with-magnetometer), so whatever you are calling magnetometer data cannot be magnetometer data.
Also from CMMotionManager Class Reference (my emphasis)
So you won't be able to produce a magnetic heading.
What you are seeing is motion data from the other sensors that the iPod touch does have.