本文介绍了iOS9中来自CLLocationManager的奇怪位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一款可以记录距离的步行应用程序,在iOS7,iOS8上,距离虽然有时有时不准确,但大部分都很好,但是在iOS9.0上,距离通常太大,所以我检查

I have developed a walk app that can record distance, on iOS7, iOS8, the distance is mostly fine although sometimes not accurate, but on iOS9.0, the distance often too large, so I check

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray<CLLocation *> *)

Locations方法,并花一些时间来获取这样的位置:A,B,C,但是C的坐标等于A,我认为是很奇怪

Locations method, and find some time get locations like this: A、B、C, but coordinate of C is equal to A, which i think is weird

我发现每秒钟调用一次 startUpdatingLocation ,在摆脱它之后,它会变得更好,但仍然会发生

I find startUpdatingLocation called every seconds, after get rid of it , it gets better, but still happens

这是演示

推荐答案

对于ios 9,您必须设置allowBackgroundLocationUpdates。

For ios 9, you have to set allowsBackgroundLocationUpdates.

这篇关于iOS9中来自CLLocationManager的奇怪位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 17:16