title: The app's Info.plist must contain an NSLocationWhenInUseUsageDescription key with a string value explaining to the user how the app uses this data
body: <p>I am new to IOS. I am trying to use Maps to get user's current location. The tutorial i am following is for IOS 10. </p>
  
  <p>I went through this post and did everything it said but still it doesn't work
  <a href="https://stackoverflow.com/questions/44424092/location-services-not-working-in-ios-11">Location Services not working in iOS 11</a></p>
  
  <p>Following is my code</p>
  
  <pre><code>class ViewController: UIViewController,CLLocationManagerDelegate,MKMapViewDelegate {
  
      var locationManager=CLLocationManager()
      // @IBOutlet weak var mapView: MKMapView!
      @IBOutlet weak var mapView: MKMapView!
  
      override func viewDidLoad() {
          super.viewDidLoad()
          // Do any additional setup after loading the view, typically from a nib.
  
          locationManager.delegate=self
          locationManager.desiredAccuracy=kCLLocationAccuracyBest
          locationManager.requestWhenInUseAuthorization()
          locationManager.startUpdatingLocation()
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  
      func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
          let userLocation:CLLocation = locations[0]
          let latitude=userLocation.coordinate.latitude
          let longitude=userLocation.coordinate.longitude
          let latDelta:CLLocationDegrees=0.05
          let lonDelta:CLLocationDegrees=0.05
          let span=MKCoordinateSpan(latitudeDelta:latDelta, longitudeDelta:lonDelta)
          let location=CLLocationCoordinate2D(latitude:latitude,longitude:longitude)
          let region=MKCoordinateRegion(center:location,span:span)
          self.mapView.setRegion(region,animated:true)
  
      }
  
  
  
  }
  </code></pre>
  
  <p>I have added following in my info.plist file</p>
  
  <pre><code>&lt;key&gt;NSLocationAlwaysUsageDescription&lt;/key&gt;
      &lt;string&gt;Program requires GPS to track cars and job orders&lt;/string&gt;
      &lt;key&gt;NSLocationAlwaysAndWhenInUseUsageDescription&lt;/key&gt;
      &lt;string&gt;Program requires GPS to track cars and job orders&lt;/string&gt;
      &lt;key&gt;NSLocationWhenInUseUsageDescription&lt;/key&gt;
      &lt;string&gt;Program requires GPS to track cars and job orders&lt;/string&gt;
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>