有人可以告诉我为什么我的距离过滤器设置为30米后每两步左右更新一次位置更新?
- (void)initLocationTrackingStandard
{
[self.locationManager setPausesLocationUpdatesAutomatically:YES];
[self.locationManager setActivityType:CLActivityTypeOther];
[self.locationManager setDistanceFilter:30.0];
[self.locationManager setDesiredAccuracy:kCLLocationAccuracyNearestTenMeters];
[self.locationManager startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
CLLocation* location = [locations lastObject];
NSDate* eventDate = location.timestamp;
NSTimeInterval howRecent = [eventDate timeIntervalSinceNow];
if (abs(howRecent) < 5.0)
{
// Use location if it is within 5 seconds
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.alertBody = @"update location";
localNotification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] presentLocalNotificationNow:localNotification];
}
}