我使用以下条件来确保我得到的位置有足够的精度,在我的例子中是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时,在我真正得到一个准确的结果之前,我得到了不准确的结果。您使用哪些方法来获取准确/精确的位置信息?
发布于 2010-05-04 13:24:44
我得到不准确结果的主要原因是由于这种情况:
if(newLocation.horizontalAccuracy < manager.desiredAccuracy)
我使用kCLLocationAccuracyBest作为desiredAccuracy,它是一个负数。你不应该用它来做比较。
解决方案:if(newLocation.horizontalAccuracy < 10.0)
发布于 2010-04-16 13:49:28
GPS很慢,至少与用户的耐心相比是这样的,所以位置管理器会返回最好的,直到它得到一个新的、有效的GPS读取。你可以让用户等待多长时间才能获得准确的读数,也可以像谷歌地图那样,用圆圈而不是圆点来获得某种增量反馈。
https://stackoverflow.com/questions/2650818
复制相似问题