I tried to implement MapKit and CoreLocation in my project. Unfortunately the error keep showing
This app has attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSLocationWhenInUseUsageDescription key with a string value explaining to the user how the app uses this data
so here's my code and info.plist
import Foundation
import CoreLocation
import MapKit
class ViewController: UITabBarController, CLLocationManagerDelegate{
let locationManager: CLLocationManager = CLLocationManager()
@IBAction func backBarButton(_ sender: Any) {
self.dismiss(animated: true, completion:nil)
}
override func viewDidLoad() {
super.viewDidLoad()
locationManager.delegate = self
locationManager.requestWhenInUseAuthorization()
locationManager.startUpdatingLocation()
}
}
open as source code info.plist
<key>NSLocationWhenInUseUsageDescription</key>
<string>accept to get location</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>description</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>description</string>
<key>NSLocationUsageDescription</key>
<string>description</string>
open .plist as property view
I tried to create a new project and it works smoothly, however when I tried to implement this on my existing project it doesn't work.
