0

基本的に、アプリの Location-Controller が機能します。しかし、長時間実行すると、それを認識せずに間違った位置を取得します。gps-buffer がオーバーフローしているか、そのようなものだと思います。

これが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;
}

}

ロケーションバッファをフラッシュすることは可能ですか? または三角測量からの値で位置を制御しますか?

4

1 に答える 1

1

位置データの経過時間もテストする必要があります。これは、キャッシュのフラッシュに最も近い方法です (これは不可能です)。プロパティを確認し、timestamp古すぎる場合は更新を拒否してください。

// check that the location data isn't older than 60 seconds
if ([newLocation.timestamp timeIntervalSinceReferenceDate] < [NSDate timeIntervalSinceReferenceDate] - 60) {
    return;
}
于 2010-06-25T15:16:00.993 に答える