kCLErrorLocationUnknown The location
manager was unable to obtain a
location value right now.Available in
iPhone OS 2.0 and later. Declared in
CLError.h.
kCLErrorDenied Access to the location
service was denied by the user.
Available in iPhone OS 2.0 and later.
Declared in CLError.h.
kCLErrorNetwork The network was
unavailable or a network error
occurred. Available in iPhone OS 3.0b
and later. Declared in CLError.h.
kCLErrorHeadingFailure The heading
could not be determined. Available in
iPhone OS 3.0 and later. Declared in
CLError.h.
So this means the location could not be determined.
I would guess the most likely cause is that the location manager is using WiFi to triangulate the location, and the database doesn't cover the local networks. That apparently can be fixed by the user if they go here.
However as I noted I have also seen this occasionally as a transient error when running a location based program in a location where the WiFi location stuff normally works.
Lastly I guess it is possible to see this error if there is some kind of hardware failure.
I just had this problem. Took me a while to find the solution, which is only loosely related to the previous poster's answer.
Airport (WiFi) must be on for CoreLocation in the iPhone/iPad Simulator to work. I was connected via Ethernet so CL didn't do anything in the Simulator. Turn on Airport in your Network Settings and try again. You can change the order of your network interfaces by dragging Airport below Ethernet if you want to continue favoring your wired connection over your wireless...
This error is thrown when Location Manager is unable to get location information immediately. I found that this error was occurring when startUpdatingLocation method was called. For me, this was happening on iPod but not on iPhone. That makes sense, since, iPhone has more ways (like cellular network) to get location information and is able get a quick estimate on the location whereas iPod takes more time which caused this error to be raised on iPod.
Since, when this error is thrown locationManager:didFailWithError: delegate method is called, one can handle this specific case in a conditional statement by matching "[error domain]" and "[error code]" from the error object passed to this method.
This error occurs if you have Scheme/Edit Scheme/Options/Allow Location Simulation checked but don't have a default location set. I'm sure there are other causes as well though.
THANKS TO Ben Marten
You can make it permanent using these steps in XCode:
Product > Scheme > Edit Scheme
Click Run .app
Option tab
Already checked Core Location > select your location
Press OK
Besides that, even if you are not connected to wifi, you can set a location in simulator through top menu items Debug>Location and to make it permanent follow steps above
The exact reason what I have found is there is a conflict occuring in the location simulation in both the ios simulator “Debug settings” and in the xcode settings “Edit schemes”.Ensure to set you default user location in any one of this and mark the other to None solved the problem hope this might help for sure.
InXcode:
Some GPX files you might get from different sources might have the following elements indicating the different coordinates in specified path. This wont work with Xcode's Location Simulation.
What you should do is find all occurrences of the "trkpt" element and replace it with "wpt" in your favorite text/xml editor. The end result should be something as follows:
all of this didn't work for me.. what worked for me is :-
set the location from the simulator to none then change it back to custom location while the app is running.
All of the suggestions didn't help in my case. What helped was to uninstall the app from the simulator device, reinstall it and allow it to access the location (in the settings app).