CMAltimeter
An object that initiates the delivery of altitude-related changes.
Declaration
class CMAltimeterOverview
Altitude events report changes in both the relative and absolute altitude. For example, a hiking app could use this object to track the user’s elevation change over the course of a hike, or to report their current absolute altitude during the hike.
Because altitude events may not be available on all devices, always call the isRelativeAltitudeAvailable() method before starting relative altitude updates, and call isAbsoluteAltitudeAvailable() before starting absolute altitude updates.
After checking the availability of altitude data, call the startRelativeAltitudeUpdates(to:withHandler:) method to start receiving relative altitude data, or call the startAbsoluteAltitudeUpdates(to:withHandler:) method for absolute altitude data.
Core Motion generates events at regular intervals (regardless of whether the data has changed) and delivers them to the block you specified. When you no longer need the event data, call the stopRelativeAltitudeUpdates() or stopAbsoluteAltitudeUpdates() methods respectively.
Topics
Determining Altitude Availability
isAbsoluteAltitudeAvailable()isRelativeAltitudeAvailable()authorizationStatus()CMAuthorizationStatus