Jayasabeen Appukuttan
Jayasabeen Appukuttan

Reputation: 1440

CLLocationManager update location is not accurate

I am using CLLocationManager to access the user location the following delegate method return coordinates which are not accurate

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

}

Upvotes: 1

Views: 1602

Answers (3)

nitin.agam
nitin.agam

Reputation: 2142

There are two cases to as you said "Not accurate".

  1. Not a current location which you are expecting.
  2. Little bit difference in latitude and longitude of your current location.

Case 1: Change your current location in your iPhone and then try again to fetch your location.

Case 2: In that case, you should set some values to the location manager's object like desired accuracy and distance filter.

Also, share your code inside this method. Maybe you are doing something wrong.

Thanks!

Upvotes: 0

Vivek Molkar
Vivek Molkar

Reputation: 3960

locationManager:didUpdateToLocation:fromLocation: is deprecated. It is recommended to use locationManager:didUpdateLocations:. It tells the delegate that new location data is available. The most recent location update is at the end of the array locations.


Following are the properties you can explore:

distanceFilter: The minimum distance (measured in meters) a device must move horizontally before an update event is generated.

desiredAccuracy: The accuracy of the location data.

Upvotes: 2

Harshal Valanda
Harshal Valanda

Reputation: 5451

The accuracy of the location data.

locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation
locationManager.distanceFilter = kCLLocationAccuracyHundredMeters

You should assign a value to this property that is appropriate for your usage scenario.

For example If you need the current location only within a kilometer, you should specify kCLLocationAccuracyKilometer and not kCLLocationAccuracyBestForNavigation. Determining a location with greater accuracy requires more time and more power.

Upvotes: 1

Related Questions