Code below should get current location. But above error is generated. Function didUpdateLocations never gets called.
Running this on a device (iPhone 5s)iOS 9.1. Info.plist has Required device capabilities and Privacy - Location usage description configured as shown in the attached image. Please help!
let locationManager = CLLocationManager() override func viewDidLoad() { super.viewDidLoad() locationManager.delegate = self locationManager.requestAlwaysAuthorization() locationManager.requestLocation() } func locationManager(manager: CLLocationManager, didFailWithError error: NSError) print(error.description) } func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { print(“got location”) }
Please try this :
Go to :
EDIT : As mentionned in the comments, also restart Xcode and you're done !
Hope this helps.
In XCode 11.5 and up...
Open your Simulator:
Features => Location => CustomLocation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With