Getting Altitude(height from sea level) of my location in iphone SDK

前端 未结 2 981
南笙
南笙 2021-01-01 02:04

I am trying to get Altitude of my location in my application. But every time I try altitude property of CLLocation object I am getting 0.00

2条回答
  •  渐次进展
    2021-01-01 02:43

    To answer your original question: GPS will always be used if you set desiredAccuracy to Best or BestForNavigation, and distanceFilter to kCLDistanceFilterNone when configuring the CLLocationManager. You will then also get altitude values in the CLLocation event.

    However, it takes a short while before the GPS has "locked in" to enough satelites to be able to report the altitude. During that time it will report CLLocation events without altitude values. Therefore, you should ignore the first couple of events until the verticalAccuracy value is good enough for you. Also, check the timestamp, because sometimes the first CLLocation event is an old one.

提交回复
热议问题