Framework

Core Motion

Process accelerometer, gyroscope, pedometer, and environment-related events.

Overview

Core Motion reports motion- and environment-related data from the onboard hardware of iOS devices, including from the accelerometers, gyroscopes, pedometers, magnetometers, and barometers. You use this framework to access hardware-generated data so that you can use it in your app. For example, a game might use accelerometer and gyroscope data to control onscreen game behavior.

Many services of this framework let you access both the raw values recorded by the hardware and a processed version of those values. Processed values do not include forms of bias that might adversely affect how you use that data. For example, a processed accelerometer value reflects only the acceleration caused by the user and not the acceleration caused by gravity.

Topics

First Steps

class CMMotionManager

The object for starting and managing motion services.

class CMLogItem

The base class for all motion-related data objects.

Device Motion

Deliver acceleration, attitude, rotation, and magnetic field data that is adjusted for gravity and other forms of bias.

Getting Processed Device Motion Data

Retrieve data that has already been processed to remove environmental bias, such as the effects of gravity.

class CMDeviceMotion

Encapsulated measurements of the attitude, rotation rate, and acceleration of a device.

class CMAttitude

The device’s attitude—its orientation relative to a known frame of reference—at a point in time.

Accelerometers

Deliver accelerometer data for all three axes of the device.

Getting Raw Accelerometer Events

Learn how to retrieve data from the onboard accelerometers.

class CMAccelerometerData

A data sample from the device's three accelerometers.

class CMRecordedAccelerometerData

A single piece of accelerometer data that was recorded by the device.

class CMSensorRecorder

The gathering and retrieval of accelerometer data from a device.

class CMSensorDataList

A list of the accelerometer data recorded by the system.

Gyroscopes

Deliver the raw gyroscope data.

Getting Raw Gyroscope Events

Learn how to retrieve data from the onboard gyroscope.

class CMGyroData

A single measurement of the device’s rotation rate.

Pedometer

Provide step-counting data from the built-in motion processor.

class CMPedometer

An object for fetching the system-generated live walking data.

class CMPedometerData

Information about the distance traveled by a user on foot.

class CMPedometerEvent

A change in the user's pedestrian activity.

class CMStepCounter

The number of steps the user has taken with the device.

Deprecated

Magnetometer

Provide compass-level orientation data and raw magnetometer data.

class CMMagnetometerData

Measurements of the Earth's magnetic field relative to the device.

Altitude

Provide altitude data based on barometric sensor information.

class CMAltimeter

An object that initiates the delivery of altitude-related changes.

class CMAltitudeData

Data for a recorded change in altitude.

Historical Data

Deliver recorded motion events to help you analyze movement patterns.

class CMMotionActivityManager

An object that manages access to the motion data stored by the device.

class CMMotionActivity

The data for a single motion update event.

See Also