Reputation: 814
I have a CLLocation manager. It works fine.
locManager = CLLocationManager()
locManager.delegate = self
locManager.desiredAccuracy = kCLLocationAccuracyBest
locManager.requestWhenInUseAuthorization()
locManager.startUpdatingLocation()
And of course, I have the delegate methods:
func locationManager(manager: CLLocationManager, didFailWithError error: NSError) {
println("didfail")
println(error)
}
func locationManager(manager:CLLocationManager, didUpdateLocations locations:[AnyObject]) {
println("location manager called..")
let locationLast = locations.last as! CLLocation
latitude = locationLast.coordinate.latitude.description
longitude = locationLast.coordinate.longitude.description
locManager.stopUpdatingLocation()
//....
}
There is no any problem it's working! But, when i'm here 47.5775679 19.0488392 (or at in 1-2km radius of this point ) it's throws this error:
Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error 0.)"
I was tried with simulator and real devices too. I have internet connection on the real devices when i was trying. Is there a black hole? :) or i don't know.
Could anybody please give me any idea about, what cause this phenomenon?
Thank you!
Upvotes: 3
Views: 4212
Reputation: 7145
This is an old question/answer but it does not consider the use case of the Simulator. That is, make sure that you do not have Debug > Location > None selected like so:
Be sure to select a valid location like Apple's HQ in Cupertino for instance:
Upvotes: 2
Reputation: 2654
This is happen when your device is not able find out your location from actual GPS system , wifi or internet. My observation is that when device(it was iPhone 4 for my case) is in a close room and connected with Wifi using hotspots from Laptop then most the time I am getting this same error.
Possible Solutions -
If you got this error try to call locManager.stopUpdatingLocation() and again call locManager.startUpdatingLocation().
Check your device having valid WIFI or 3G/2G Internet connection
Go to settings and reset your location services
Reset your network settings
Hope this will help you.
Upvotes: 7