【发布时间】:2017-09-22 01:12:28
【问题描述】:
我听说从 iPhone 6 开始,iPhone 配备了气压计,可以帮助获得更准确的高度读数,而不是单独使用 GPS 数据。
如何利用这个气压计传感器来获得更准确的高度?现在,我正在使用以下代码获取海拔高度:
// delegate method, constantly read latitutde and longitutde
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let userLocation:CLLocation = locations[0] as CLLocation
// get the lat/long/alt values
let alt = userLocation.altitude
altLabel.text = String(alt)
}
【问题讨论】: