title: CoreLocation requestWhenInUseAuthorization() not working in Swift
body: <p>I want my app to show the user's location but it doesn't ask for WhenInUseAuthorization. I added the NSLocationWhenInUseUsageDescription key in the Info.plist. I tried in the iOS simulator with simulate location &amp; on an actual device.  </p>
  
  <pre><code>import UIKit
  import MapKit
  import CoreLocation
  
  class ViewController: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate {
  
      @IBOutlet weak var mapView: MKMapView!
  
      var locationManager = CLLocationManager()
  
      override func viewDidLoad() {
          super.viewDidLoad()
          locationManager.delegate = self
          locationManager.desiredAccuracy = kCLLocationAccuracyBest
  
          if CLLocationManager.authorizationStatus() == .NotDetermined {
              self.locationManager.requestWhenInUseAuthorization()
          }
      }
  
      func locationManager(manager: CLLocationManager!, didChangeAuthorizationStatus status: CLAuthorizationStatus) {
  
          if CLLocationManager.authorizationStatus() == .AuthorizedWhenInUse {
              locationManager.startUpdatingLocation()
              mapView.showsUserLocation = true
  
              let userLocation = CLLocationCoordinate2DMake(locationManager.location.coordinate.latitude, locationManager.location.coordinate.longitude)
              mapView.region = MKCoordinateRegionMakeWithDistance(userLocation, 100, 100)
  
          } else {
  
              let defaultLocation = CLLocationCoordinate2DMake(45.5017, -73.5673)
              mapView.region = MKCoordinateRegionMakeWithDistance(defaultLocation, 100, 100)
          }
      }
  }
  </code></pre>