【发布时间】:2010-04-16 05:28:49
【问题描述】:
我使用以下条件来确保我获得的位置具有足够的准确性,在我的情况下是 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 时,我在实际得到准确结果之前得到了不准确的结果。您使用什么方法来获取准确/精确的位置信息?
【问题讨论】:
标签: iphone mkmapview cllocationmanager userlocation