I am getting this error:
Error while updating location The operation couldn’t be completed. (kCLErrorDomain error 0.)
My problem is that this error shows almost every time I run the simulator and it keeps showing me that error a whole time that simulator runs (every time I present viewController with a map it shows me this error).The weirdest thing is that sometimes this error is nil and everything is fine. On an actual device it works fine, but when I want to try something with location (on simulator) I have to restart the simulator about 7 times until it works.
This is Info.plist:
My Location is custom:
This is my code:
func locationManager(manager: CLLocationManager, didFailWithError error: NSError) {
print("Error while updating location " + error.localizedDescription)
let alertController = UIAlertController(title: "Sorry!", message: "We were unable to find your location", preferredStyle: UIAlertControllerStyle.Alert)
let defaultAction = UIAlertAction(title: "OK", style: .Default, handler: nil)
alertController.addAction(defaultAction)
presentViewController(alertController, animated: true, completion: nil)
print("Error...")
}
My question is why it works only sometimes? Thank you :)