iPhone OS Reference Library Apple Developer Connection spyglass button

Version: 1.1

Posted: 2009-07-15

Build Requirements: iPhone SDK 3.0

Runtime Requirements: iPhone OS 3.0 and iPhone 3GS Requires a device with a magnetometer. This sample will run in the Simulator but only one magnetic measurement will be received.

View Source Code:

Download Sample Code (“Teslameter.zip”, 49.6K)



Description

This application implements a Teslameter, a magnetic field detector. It displays the raw x, y, and z magnetometer values, a plotted history of those values, and a computed magnitude (size or strength) of the magnetic field.

The use of the Core Location API for getting "heading" data is contained in the TeslameterViewController class. It creates a CLLocationManager object and uses it to get heading by invoking -[CLLocationManager startUpdatingHeading]. It implements the CLLocationManagerDelegate APIs for receiving heading and updates its user interface accordingly.

Document Revision History

Date Notes
2009-07-15Cleaned up for post-WWDC publication.
Did this document help you? Yes It's good, but... Not helpful...