---
title: CMAltimeter
framework: coremotion
role: symbol
role_heading: Class
path: coremotion/cmaltimeter
---

# CMAltimeter

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

## Declaration

```swift
class CMAltimeter
```

## Overview

Overview 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. important: To use this API, you must include the NSMotionUsageDescription key in your app’s Info.plist file and provide a usage description string for this key. The usage description appears in the prompt that the user must accept the first time the system asks the user to access motion data for your app. If you don’t include a usage description string, your app crashes when you call this API.

## Topics

### Determining Altitude Availability

- [isAbsoluteAltitudeAvailable()](coremotion/cmaltimeter/isabsolutealtitudeavailable().md)
- [isRelativeAltitudeAvailable()](coremotion/cmaltimeter/isrelativealtitudeavailable().md)
- [authorizationStatus()](coremotion/cmaltimeter/authorizationstatus().md)
- [CMAuthorizationStatus](coremotion/cmauthorizationstatus.md)

### Starting and Stopping Altitude Updates

- [startAbsoluteAltitudeUpdates(to:withHandler:)](coremotion/cmaltimeter/startabsolutealtitudeupdates(to:withhandler:).md)
- [stopAbsoluteAltitudeUpdates()](coremotion/cmaltimeter/stopabsolutealtitudeupdates().md)
- [CMAbsoluteAltitudeHandler](coremotion/cmabsolutealtitudehandler.md)
- [startRelativeAltitudeUpdates(to:withHandler:)](coremotion/cmaltimeter/startrelativealtitudeupdates(to:withhandler:).md)
- [stopRelativeAltitudeUpdates()](coremotion/cmaltimeter/stoprelativealtitudeupdates().md)
- [CMAltitudeHandler](coremotion/cmaltitudehandler.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Altitude data

- [CMAbsoluteAltitudeData](coremotion/cmabsolutealtitudedata.md)
- [CMAltitudeData](coremotion/cmaltitudedata.md)
