Instance Method


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


func startRelativeAltitudeUpdates(to queue: OperationQueue, withHandler handler: @escaping CMAltitudeHandler)



The operation queue on which to execute your handler block. The altimeter object stores a strong reference to this object. This parameter must not be nil.


The handler block to execute when new altitude data is available. This parameter must not be nil. For information about the format of this block, see CMAltitudeHandler.


Call this method to initiate the delivery of events. The altimeter object stores a strong reference to the specified queue and makes a copy of your block. If you call the method a second time, the altimeter object releases its references to the previous queue and handler before storing references to the new ones. So only the last installed handler receives events. When you no longer need the altitude data, or when an error occurs, call the stopRelativeAltitudeUpdates() method to stop the delivery of events.

If altitude data is not available on the current device, this method does nothing.

See Also

Starting and Stopping Altitude Updates

func stopRelativeAltitudeUpdates()

Stops the delivery of altitude data for this altimeter object

typealias CMAltitudeHandler

A block for receiving altitude data.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software