1

I find that often while using CLLocationManager:

self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
self.locationManager.distanceFilter = 10;

and it's delegate method:

-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations;

I will get results that look like the below, even while not moving at all. I know the location service is not always 100% accurate and is subject to network conditions, but is there some way to filter out bad locations so that I don't end up with random stray points like this?

enter image description here

soleil
  • 12,133
  • 33
  • 112
  • 183

1 Answers1

2

That's weird. We almost have the same code and mine's working. Did you execute [self.locationManager startUpdatingLocation] once?

Also try adding [self.locationManager startMonitoringSignificantLocationChanges]

dizzyboy
  • 370
  • 6
  • 19
  • Thanks for the tip on `startMonitoringSignificantLocationChanges`. I will switch to that and do some testing. – soleil Mar 06 '15 at 23:41
  • I tried switching to `startMonitoringSignificantLocationChanges`, but then I get no location updates at all. Do you have to do anything else to get iOS to think a location change is significant? – soleil Mar 07 '15 at 00:27
  • this is my code for initializing my locationManager `- (CLLocationManager *)locationManager` `{` `if (!_locationManager) {` _locationManager = [[CLLocationManager alloc] init]; _locationManager.delegate = self; _locationManager.desiredAccuracy = kCLLocationAccuracyBest; if ([_locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) { [_locationManager requestWhenInUseAuthorization]; } [_locationManager startMonitoringSignificantLocationChanges]; } return _locationManager; } – dizzyboy Mar 09 '15 at 12:48
  • also check this link for iOS 8 location services http://stackoverflow.com/questions/24062509/location-services-not-working-in-ios-8http://stackoverflow.com/questions/24062509/location-services-not-working-in-ios-8 – dizzyboy Mar 09 '15 at 12:55