Hi, How to call the CoreMotion Manager to fill the CMAmbientPressureData class in iOS? I couldn't find any methods for this. In the header of CoreMotion, I can see methods like startAmbientPressureUpdates, but I cannot use those in Xcode? Any advise?
My understanding is that CMAmbientPressureData is an internal class, which is then used by CMAltimeter to calculate relative altitude based on pressure changes. The data from CMAltimeter.startRelativeAltitudeUpdates
has a pressure property that provides the atmospheric pressure, as an NSNumber of kilopascals, of the reported relative altitude.
As of iOS 15 there is a CMAbsoluteAltitudeData class that provides the absolute altitude (and changes thereof), but I can't see a pressure property available via the updates handler.
I've been using CMAltimeter data on a regular basis for a couple of years in my running app and the update handler consistently provides an update every second, irrespective of an altitude (or pressure) change or not. Most of my runs start and end at the same location, so I often see a discrepancy of 2 to 5 metres between the start and end relative altitudes - which coincide with the atmospheric pressure change at that location as recorded by the Bureau of Meteorology.
I haven't accessed the pressure property of CMAltitudeData but, from the foregoing, I conclude that it would be a fairly accurate recording of the current ambient pressure of a location. For my purposes, the CMAltimeter data are far more accurate and consistent than the altitude data from CoreLocation.
I hope this helps. Best wishes and regards, Michaela