本文介绍了控制iOS GPS输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的iPhone GPS有问题;我试图记录一条不在街道上的轨道,但是每当我通过一条街道时(看封闭的图像),在我看来,GPS输出已用地图数据修正;
是否有办法禁用这个beahviour?我需要我的应用程序中的精确点



解决方案

为避免出现捕捉道路功能,请设置 activityType CLActivityTypeOtherNavigation 。 activityType的所有其他值(其他,Fitness,AutoNav)将捕捉到最近的道路。



这是我们最近从WWDC的苹果工程师那里得到的建议。我们还通过采用4个iPhone 5设备(每个activityType一个,另外还有一个Trimble GPS作为参考)并在道路上和道路上进行广泛的测试(见下图)来验证这一点(在iOS 7.1.2上)。



我们还没有在iOS 8上测试过,这种行为可能会改变,因为它没有记录。



注意:如果您的应用中有多个 CLLocationManager 实例,则必须将它们设置为相同的 activityType 。如果他们有不同的价值观,第一个开始可能是决定他们如何表现的一个,我们也有问题。例如, MKMapView 创建它自己的 CLLocationManager

这里是我们测试结果的一个例子。橙色线是 CLActivityTypeOtherNavigation ,蓝色,绿色和红色是其他3种活动类型。您可以看到蓝色,绿色和红色沿着道路中心线,橙色线则使用原始GPS位置。 //i.stack.imgur.com/MEb1q.pngalt =在这里输入图片描述>


I have a problem with iPhone GPS ; i'm trying to record a track that is not on a street , but each time I pass near a street ( look at enclosed image ) it seems to me that the gps output is corrected with maps data ;Is there a way to disable this beahviour ? I need the precise point in my app

解决方案

To avoid the "snap to road" feature, set the activityType to CLActivityTypeOtherNavigation. All other values (Other, Fitness, AutoNav) for activityType will snap to the nearest road.

This was the advice we received from an Apple engineer at WWDC recently. We also verified this (on iOS 7.1.2) by taking 4 iPhone 5 devices (one for each activityType, plus a Trimble GPS for reference) and doing extensive testing on and off roads (see map below).

We have not tested on iOS 8 yet, this behavior could change, since it is undocumented.

Caution: if there is more than one instance of CLLocationManager in your app, they must be set to the same activityType. If they have different values, the first one started may be the one that determines how they all behave, we had problems with this too. MKMapView creates its own CLLocationManager, for example.

Here is a sample of our test results. The orange line is CLActivityTypeOtherNavigation, the blue, green and red are the other 3 activity types. You can see that the blue, green and red follow the center line of the road, while the orange line uses the raw GPS position.

这篇关于控制iOS GPS输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 10:14