Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Location Manager Error : (KCLErrorDomain error 0)

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.


UPDATE

THANKS TO Ben Marten You can make it permanent using these steps in XCode:

  1. Product > Scheme > Edit Scheme
  2. Click Run .app
  3. Option tab
  4. Already checked Core Location > select your location
  5. 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

location error in ios simulator


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...


From the API docs:

CLError

Error codes returned by the location manager object.

typedef enum { kCLErrorLocationUnknown = 0, kCLErrorDenied, kCLErrorNetwork, kCLErrorHeadingFailure } CLError;

Constants

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.


1) check that you actually have a valid WiFi and 3G connection

if you do then

2) go to settings and reset your location services 3) reset your network settings