Instance Property

magneticHeading

The heading (measured in degrees) relative to magnetic north.

Declaration

var magneticHeading: CLLocationDirection { get }

Discussion

The value in this property represents the heading relative to the magnetic North Pole, which is different from the geographic North Pole. The value 0 means the device is pointed toward magnetic north, 90 means it is pointed east, 180 means it is pointed south, and so on. The value in this property should always be valid.

In iOS 3.x and earlier, the value in this property is always measured relative to the top of the device in a portrait orientation, regardless of the device’s actual physical or interface orientation. In iOS 4.0 and later, the value is measured relative to the heading orientation specified by the location manager. For more information, see the headingOrientation property in CLLocationManager.

If the headingAccuracy property contains a negative value, the value in this property should be considered unreliable.

See Also

Accessing the Heading Attributes

var trueHeading: CLLocationDirection

The heading (measured in degrees) relative to true north.

var headingAccuracy: CLLocationDirection

The maximum deviation (measured in degrees) between the reported heading and the true geomagnetic heading.

var timestamp: Date

The time at which this heading was determined.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software