CMMagnetometerData Class Reference

Inherits from
Conforms to
Framework
/System/Library/Framework/CoreMotion.framework
Availability
Available in iOS 5.0 and later.
Declared in
CMMagnetometer.h

Overview

Instances of the CMMagnetometerData class encapsulated measurements of the magnetic field made by the device’s magnetometer.

Your application can obtain samples of magnetometer measurements, as represented by instances of this class, from the block handler of the startMagnetometerUpdatesToQueue:withHandler: method or from the magnetometerData property of the CMMotionManager class.

Tasks

MethodGroup

Properties

magneticField

Returns the magnetic field measured by the magnetometer. (read-only)

@property(readonly, nonatomic) CMMagneticField magneticField
Discussion

The value of this property is the total magnetic field observed by the device which is equal to the Earth’s geomagnetic field plus bias introduced from the device itself and its surroundings.

This is the “raw” magnetic-field value, unlike the calibrated value of the magneticField property of CMDeviceMotion which filters out the bias introduced by the device and, in some cases, its surrounding fields.

Availability
  • Available in iOS 5.0 and later.
Declared In
CMMagnetometer.h

Constants

CMMagneticField

A structure containing 3-axis magnetometer data

typedef struct {
   double x;
   double y;
   double z;
} CMMagneticField;
Fields
x

X-axis magnetic field in microteslas.

y

Y-axis magnetic field in microteslas.

z

Z-axis magnetic field in microteslas.

Availability
  • Available in iOS 5.0 and later.
Declared In
CMMagnetometer.h