Reputation: 1440
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
Reputation: 2142
There are two cases to as you said "Not accurate".
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
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
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