1

i am using LocationManager to get user location coordinates as below..

  locationManager.requestAlwaysAuthorization()
  locationManager.requestWhenInUseAuthorization()
  locationManager.startUpdatingLocation()
  locationManager.desiredAccuracy = kCLLocationAccuracyBest
  locationManager.delegate = self
  locationManager.distanceFilter = 50

I noticed i get different coordinates when running on two devices iphone5s and iphone 6.and the distance between them is like about 70 -100 meters when i use distanceFromLocation method

Why is this happening?

How to get the best user location??

2 Answers2

0

kCLLocationAccuracyBest is the best you can do regarding accurracy of a single position. It will take into account WIFI, GPS and radio signal and will usually only be a few meters off.

Nevertheless, if you are moving, set the distanceFilter to a lower value to make sure you are notified more often about the new position. Distance filter 50 means that you are notified if the user moves 50 meters, which could explain your inaccuracy.

MarkHim
  • 5,686
  • 5
  • 32
  • 64
  • locationManager.distanceFilter = 50 if i dont set these....didupdatelocation calls multiple times.. –  Sep 08 '15 at 11:51
  • it is supposed to be called multiple times, whenever the location is updated. You can also access the lastKnown location from the locationManager.lastKnownLocation. – MarkHim Sep 08 '15 at 11:53
0

The main problem is the distanceFilter set to 50. Just remove that.
Under normal GPS condition accuracy will be about 6m. So you can expect about 2*6 = 12m distance between two users at the same position.

However if users are inisde a building the situation becomes worse, and the distance between them probably increases.

AlexWien
  • 28,470
  • 6
  • 53
  • 83
  • ok i will remove that and retest again...yes while testing user was inside the building....need to debug all possible condition –  Sep 09 '15 at 05:30