0

我正在使用以下条件以确保我获得的位置具有足够的准确性,在我的情况下为 kCLLocationAccuracyBest。但问题是我的位置仍然不准确。

// Filter out nil locations
if(!newLocation)
    return;

// Make sure that the location returned has the desired accuracy
if(newLocation.horizontalAccuracy < manager.desiredAccuracy)
    return;

// Filter out points that are out of order    
if([newLocation.timestamp timeIntervalSinceDate:oldLocation.timestamp] < 0)
    return;

// Filter out points created before the manager was initialized
NSTimeInterval secondsSinceManagerStarted = [newLocation.timestamp timeIntervalSinceDate:locationManagerStartDate];
if(secondsSinceManagerStarted < 0)
    return;

// Also, make sure that the cached location was not returned by the CLLocationManager (it's current) - Check for 5 seconds difference
if([newLocation.timestamp timeIntervalSinceReferenceDate] < [[NSDate date] timeIntervalSinceReferenceDate] - 5)
    return;

当我激活 GPS 时,我在实际得到准确结果之前得到了不准确的结果。您使用什么方法来获取准确/精确的位置信息?

4

2 回答 2

0

我得到不准确结果的主要原因是因为这种情况:

if(newLocation.horizontalAccuracy < manager.desiredAccuracy)

kCLLocationAccuracyBest按期望使用Accuracy,它是一个负数。你不应该用它来比较。

解决方案: if(newLocation.horizontalAccuracy < 10.0)

于 2010-05-04T05:24:43.573 回答
0

GPS 很慢,至少与用户的耐心相比,因此位置管理器会返回它所拥有的最佳值,直到它获得一个新的、有效的 GPS 读数。您可以让用户等待获得准确读数所需的时间,或者像谷歌地图那样提供某种增量反馈,用圆圈而不是点。

于 2010-04-16T05:49:28.073 回答