0

So, my app requires to capture location every 15 meter.

in viewDidLoad

NSOperationQueue.mainQueue().addOperationWithBlock {
    self.manager = CLLocationManager()
    self.manager.delegate = self
    self.manager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters
    self.manager.distanceFilter = 15.0
    self.manager.headingFilter = 10
    self.manager.startUpdatingLocation()
}

First time (i don't move), in

func locationManager(manager:CLLocationManager, didUpdateLocations locations:[AnyObject])

i get (real example): *.1488241293991 *.5997807433053

second time: *.1489010891664 *.599624152471

I test on real device with ios7, and swift.

What am I doing wrong?

Thanks!

heming
  • 93
  • 10
  • i think its helpful for u http://stackoverflow.com/questions/24736046/how-to-find-map-annotations-that-fit-my-criteria/24736634#24736634 – Ilesh P Jul 30 '14 at 09:04

1 Answers1

1

From CLLocationManager Class Reference:

When requesting high-accuracy location data, the initial event delivered by the location service may not have the accuracy you requested. The location service delivers the initial event as quickly as possible. It then continues to determine the location with the accuracy you requested and delivers additional events, as necessary, when that data is available.

So the first location you retrieve might be inaccurate.

zisoft
  • 22,770
  • 10
  • 62
  • 73
  • same thing at desiredAccuracy = kCLLocationAccuracyThreeKilometers . – heming Jul 30 '14 at 09:51
  • This is the normal behavior of the location manager. The first position will be delivered as quick as possible, even if it is inaccurate. The next delivered position is more accurate and maybe at a (slightly) different location, even without moving. If this is not what you want, think about ignoring the first two or three delivered locations. – zisoft Jul 30 '14 at 11:40