CLLocationManager
on iPhone Simulator is supposed to fake Cupertino (isn't it?) but it does NOT, it fails with kCLErrorDomain Code=0
instead. LocationManager's delegate receives the message didFailWithError
. This method is implemented to log the error and the console outputs the following:
Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error 0.)"
I was working on a real project when I ran into this problem but it is pointless to discuss my code because I downloaded "Locations" sample code (updated 2010-06-22 for iOS 4) from the dev center and the problem persisted.
The app is suposed to enable an "add" button when it receives the first location update so users can track their locations but it does nothing.
I added one (trivial) line to the implementation of didFailWithError
to log the errors, if any. I get the error described above.
With Xcode 3.2.2 and targeting 3.1.3, I could get a fixed location (Cupertino) when running an older version of the "Locations" project.
Can somebody help?
Thanks.
CLLocationManager
started to work as expected again on the iOS Simulator 5.0.
In my experience, it used to fail consistently with kCLErrorDomain Code=0
on the iOS Simulator 4.0 through 4.3. Turning the airport on and connecting to a Wi-Fi, as suggested by the other answers, did not help in my case. However, I would like to thank everybody for their answers. I simply worked around this issue by testing all the Core Location code on a device.
Recently I upgraded to XCode 4.2 (from XCode 3.2.6) and the iOS Simulator 5.0 that comes with it, and as a result of that, I noticed that the CLLocationManager
started to work as expected again. When selecting an older simulator in XCode 4.2, it keeps failing; which points to the simulator as the one to blame.