title: Location Manager not updating location in swift. AlertView disappears
body: <p>I want to get location inside a custom delegate in swift. Note that this worked perfectly 2 hours ago. The major problem is that the Location authorization alertView disappears by its own before I get to Allow it. So i tried to go within settings and allow it but it does not work. Why is the alertView disappearing by it self and why even though I allowed it through the settings I still cannot get an update? I added the correct key in the plist and also added the delegate and CoreLocation framework in the file. Also note that the didFail is not called at any point. Any advise would be appreciated</p>
  
  <pre><code>func getLocation(){
      println("called")
      let locationManager:CLLocationManager = CLLocationManager()
      locationManager.delegate = self
      locationManager.desiredAccuracy = kCLLocationAccuracyBest
  
      let status = CLLocationManager.authorizationStatus()
      println(status.rawValue)
  
      if(status != CLAuthorizationStatus.Authorized) {
          locationManager.requestWhenInUseAuthorization()
          println("called2")
      }else{
          locationManager.startUpdatingLocation()
          println("allowed and updating")
      }
  
  
  
  
  }
  
  
  
  func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {
      println("updating")
  
      var locationArray = locations as NSArray
      var locationObj = locationArray.lastObject as CLLocation
  
      println(locationObj)
  
  }
  
  func locationManager(manager: CLLocationManager!, didFailWithError error: NSError!) {
      println(error)
  }
  
  
  
  func locationManager(manager: CLLocationManager!,
      didChangeAuthorizationStatus status: CLAuthorizationStatus) {
          var shouldIAllow = false
          println(status)
          switch status {
          case CLAuthorizationStatus.Restricted:
              println("Restricted Access to location")
          case CLAuthorizationStatus.Denied:
              println("User denied access to location")
          case CLAuthorizationStatus.NotDetermined:
              println("Status not determined")
          default:
              println("Allowed to location Access")
              shouldIAllow = true
          }
  
          if (shouldIAllow == true) {
              manager.startUpdatingLocation()
          } else {
              println("Denied access: \(status)")
          }
  }
  </code></pre>