I\'m trying to use some fancy iBeacons without success, kCLAuthorizationStatusNotDetermined all time. According to other questions it\'s a requirement to add those keys to
recently, IOS 13, * save result request permission after user reinstall app
Swift 3.X Latest code easily usage
import CoreLocation
public var locationManager = CLLocationManager()
override func viewDidLoad() {
super.viewDidLoad()
locationManager.delegate = self
locationManager.requestAlwaysAuthorization()
locationManager.startUpdatingLocation()
}
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let altitudeG = locations.last?.altitude
let longitudeG = locations.last?.coordinate.longitude
let latitudeG = locations.last?.coordinate.latitude
print("\(altitudeG) \(longitudeG) \(latitudeG)")
}
Make sure you add the keys to the correct Info.plist file. Don't forget there's one for your App and one for AppTest.
Had exactly the same problem.
It turned out that in my case the NSLocationAlwaysUsageDescription
was required in my InfoPlist.strings
localization files as well. Having NSLocationAlwaysUsageDescription
in Info.plist
wasn't enough...
Try to Start Updating Location (have helped for me)
[self.locationManager startUpdatingLocation];