Class

CMAltimeter

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

Overview

Altitude events reflect the change in the current altitude, not the absolute altitude. So a hiking app might use this object to track the user’s elevation gain over the course of a hike. Because altitude events may not be available on all devices, always call the isRelativeAltitudeAvailable method before using this service.

After checking for the availability of altitude data, you start the delivery of events by calling the startRelativeAltitudeUpdatesToQueue:withHandler: method. Core Motion generates events at regular intervals (regardless of whether the data has changed) and delivers them to the block you specified at startup. When you no longer need the event data, call the stopRelativeAltitudeUpdates method.

Core Motion delivers altimeter events only while your app is running, either in the foreground or background. If your app is suspended, event delivery stops temporarily. Event delivery resumes when your app returns to the foreground.

Topics

Determining Altitude Availability

isRelativeAltitudeAvailable

Returns a Boolean value indicating whether the current device supports generating data for relative altitude changes.

authorizationStatus

Returns a value indicating whether the app is authorized to retrieve altimeter data.

CMAuthorizationStatus

The authorization status for motion-related features.

Starting and Stopping Altitude Updates

startRelativeAltitudeUpdatesToQueue:withHandler:

Starts the delivery of altitude data to the specified handler block.

stopRelativeAltitudeUpdates

Stops the delivery of altitude data for this altimeter object

CMAltitudeHandler

A block for receiving altitude data.

Relationships

Inherits From

See Also

Altitude

CMAltitudeData

Data for a recorded change in altitude.