基本上我的应用程序中的位置控制器工作。但是如果它运行了很长时间,它会在不识别的情况下得到错误的位置。我认为 gps 缓冲区溢出或类似的。
这是我的 didUpdate-Event 代码
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
//nonvalid
if (signbit(newLocation.horizontalAccuracy))
return;
//0.0 is no valid location here
if ((abs(newLocation.coordinate.latitude) < 1.0e-05) || (abs(newLocation.coordinate.longitude) < 1.0e-05))
return;
if (newLocation.horizontalAccuracy > DBL_MAX)
return;
@synchronized(self)
{
currentCoordinate.latitude = newLocation.coordinate.latitude;
currentCoordinate.longitude = newLocation.coordinate.longitude;
}
}
是否可以刷新位置缓冲区?还是用三角测量的值控制位置?