An object that initiates the delivery of altitude-related changes.
- iOS 8.0+
- Mac Catalyst 13.0+
- watchOS 2.0+
- Core Motion
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
is method before using this service.
After checking for the availability of altitude data, you start the delivery of events by calling the
start 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
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.