0

我希望实现这个功能,当用户重复访问同一个地方时,假设一个人向前移动一米,然后向后移动一米。他应该得到与他之前得到的相同的经纬度值。我的意思是用户使用设备所走的每一步都准确无误。我怎样才能做到这一点。目前我正在使用 CLLocationManager,但是当我再次移动到同一个地方时,它最终在 lat long 中给出了 20 到 30 点的差异。请帮忙。提前致谢。

locationManager = [[CLLocationManager alloc] init];
locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move
locationManager.desiredAccuracy = kCLLocationAccuracyBest; // 100 m
locationManager.distanceFilter = 0.1f;
locationManager.delegate = self;
[locationManager startUpdatingLocation];

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{

NSDate *locationTimeStamp = newLocation.timestamp;

NSTimeInterval delta = [locationTimeStamp timeIntervalSinceNow];

NSLog(@"The location timestamp interval was %f seconds.", delta);


_latitude.text = [NSString stringWithFormat:@"%f",newLocation.coordinate.latitude];
_longitude.text  = [NSString stringWithFormat:@"%f",newLocation.coordinate.longitude];
_time.text = [NSString stringWithFormat:@"%f",delta];
}
4

0 回答 0