title: Getting many location updates
body: <p>I'm implementing user location for IOS using swift. This is my code.</p>
  
  <pre><code>import UIKit
  import CoreLocation
  
  class localizationViewController: UIViewController, CLLocationManagerDelegate {
  
      let locationManager = CLLocationManager()
  
      override func viewDidLoad() {
          super.viewDidLoad()
          // Do any additional setup after loading the view.
          self.locationManager.delegate = self
          self.locationManager.desiredAccuracy = kCLLocationAccuracyBest
          self.locationManager.distanceFilter = 500
          self.locationManager.requestWhenInUseAuthorization()
          self.locationManager.startUpdatingLocation()
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  
      func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {
          CLGeocoder().reverseGeocodeLocation(manager.location, completionHandler: { (placemarks, error) -&gt; Void in
  
              if (error != nil) {
                  println("Error: " + error.localizedDescription)
                  return
              }
  
              if placemarks.count &gt; 0 {
  
                  let pm = placemarks[0] as CLPlacemark
                  self.displayLocationInfo(pm)
              } else {
                  println("Error with data")
              }
          })
      }
  
      func displayLocationInfo(placemark: CLPlacemark) {
          self.locationManager.stopUpdatingLocation()
  
          var city = placemark.locality
          var department = placemark.administrativeArea
          var country = placemark.country
          var latitude = placemark.location.coordinate.latitude
          var longitude = placemark.location.coordinate.longitude
          var date = placemark.location.timestamp
  
          println(city)
          println(department)
          println(country)
          println(latitude)
          println(longitude)
          println(date)
      }
  
      func locationManager(manager: CLLocationManager!, didFailWithError error: NSError!) {
          println("Error: " + error.localizedDescription)
      }
  
  
      /*
      // MARK: - Navigation
  
      // In a storyboard-based application, you will often want to do a little preparation before navigation
      override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
          // Get the new view controller using    segue.destinationViewController.
          // Pass the selected object to the new view controller.
      }
      */
  
  
      @IBAction func actionLocation(sender: UISwitch) {
          println("get location request")
      }
  }
  </code></pre>
  
  <p>I'm getting the location info properly, but, always updates 3 or 4 times. I was reading that if you set the distanceFilter this stops but, it's not working for me. How can I configure my didUpdateLocations for get only one location per request? How can i run this function inside an action element (switct or button per example)? This last question because maybe the reason is that always, on the first location request, the app doesn't take the vaules of Accuary a distancefilter... Thankyou. </p>