By Mike


2009-09-11 05:31:40 8 Comments

Location Manager Error : Operation could not be completed(KCLErrorDomain error 0)

Why does this error occur?

15 comments

@Niklas D 2017-09-21 10:25:07

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

@Undistraction 2012-05-24 11:54:40

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.

@flip79 2012-09-28 17:27:06

This was my problem, thank you so much!

@Undistraction 2012-09-28 17:58:14

You're welcome.

@silentBeep 2013-06-18 07:43:44

Thanks, but my question is if we set default location does it effect the device location update?

@Undistraction 2013-06-18 10:18:19

@ShafKhan Don't answer questions in the comments. Ask it as a new question.

@Bishal Ghimire 2014-06-26 01:39:55

If you are wondering where is SCHEME follow this link developer.apple.com/library/mac/recipes/…

@Luke S 2015-05-19 14:48:24

Very helpful, thank you.

@owenfi 2015-09-09 21:26:45

I still had to "Reset Content and Settings" to get the delegate to call didUpdate instead of didFail after setting a default location in the scheme editor. Then it worked fine.

@Ifelere Bolaji 2016-09-14 13:57:16

This totally solves my problem! Thank you very much.

@fsalazar_sch 2017-08-09 05:24:22

Some has tested on a REAL device? This does not solve the problem

@Hitesh Chavda 2016-08-11 17:39:47

If you got this in Emulator then do following

Debug > Location > ✓ Apple

emulator instruction

@DeyaEldeen 2016-07-26 10:21:29

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.

@DrMickeyLauer 2016-06-20 12:24:17

If you are getting this on the device, chances are you did not ask for or the user denied the permission to gather the location.

@Matiji66 2015-12-07 06:58:40

This error occur while you run your program ,but you simulate location after you run the programe.

I get a method :quit your simulator and restart it ,then set your simulator location before you run the programe,and it works for me .

Hope this helps! It certainly helped me. thanks...

@Vaibhav Saran 2013-03-19 13:16:58

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

@Ben Marten 2014-09-14 16:29:04

To make it permanent, in Xcode: Product/Scheme/Edit Scheme .../Run/Options/Core Location - Check "Allow Location Simulation" & Set "Default Location" to "None"

@Vaibhav Saran 2014-09-15 11:14:00

Yessss, It works. Thank you so much 😃👍😄😃👌👏💃🙏💃💃. Editing my question for more knowledge :)

@Nino 2015-07-14 20:39:36

Thanks to this article (https://possiblemobile.com/2013/04/using-xcode-to-test-location-services/) I got a hint to look at the data on my custom GPX file and there found the issue.

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.

<gpx>
...
<trkpt lat="" lon="">
<ele></ele>
</trkpt>
...
</gpx>

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:

<gpx>
<wpt lat="" lon="">
<ele></ele>
</wpt>
...
</gpx>

Hope this helps! It certainly helped me.

@Janisar 2015-04-02 11:06:32

Go to Xcode project >product>scheme>edit scheme>chek location simulation>set your location> and run app again Hope it will works !

@Super Xtreem 2014-10-14 08:49:00

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:enter image description here

In iphone/ipad simulator:enter image description here

@Carl 2014-03-18 16:51:50

You can add your own list of locations to Xcode to test your applications with.

From within Xcode select the menu Debug/Simulate Location and you'll be offered:

a. "Don't Simulate Location"
b. 12 example locations
c. "Add GPX File to Project..."

Select "Add GPX File to Project..." and select the GPX file you've created.

@MeM 2011-07-20 21:56:30

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

@Parth Bhatt 2011-10-17 16:53:40

Thanks :) I got it working :)

@Renetik 2013-07-06 10:28:33

I still don’t understand why I cant get location without wifi or 3g on iPad when testing, why GPS is not used ? So user on device cant get location without internet ? I am working also on offline mode app...

@Durai Amuthan.H 2013-12-06 07:14:53

As far as i Know GPS doesn't need either internet or wifi connection.It's just a receiver if it is in accessible location with 2 or 3 of GPS satellites we can get the geo location coordinates.We need to worry about internet connection only if the GeoInformation is needed for any online activity such as google maps which depends on internet to show map locations that are not locally cached.Dedicated Navigation applications such as CoPilot keep the maps onboard.

@Vishal Chaudhry 2011-06-30 21:39:11

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.

@Meltemi 2010-10-25 21:22:48

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

@Alex Angelico 2010-12-26 22:54:03

I have this error, and my computer is connected to internet trough WiFi. Also, if I'm not mistaken, the Simulator does not resolve the location, uses always Apple Office location. When using MapKit framework, the blue dot shows, so the location is set. It doesnt make much sense.

@David H 2011-11-16 19:32:08

I just turned it on, its not the first in my network list, and everything started working (Lion, XC 4.2)

@Vinzzz 2015-02-18 08:49:52

I had the same problem, but not on simulator, on device ! (iPhone 5S, iOS 8.1.3). I was debugging an application with MapKit & CoreLocation, and both frameworks returned always the same error. Until I turned the Wifi on ! Thanks :)

@frankodwyer 2009-09-14 20:25:32

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.

@Ben Marten 2014-09-14 16:25:13

He is asking about: KCLErrorDomain

@Norman H 2015-04-20 15:33:50

There is no reference to kCLErrorDomain in this response which is what the OP is looking for.

Related Questions

Sponsored Content

25 Answered Questions

21 Answered Questions

[SOLVED] How do I get the current GPS location programmatically in Android?

22 Answered Questions

[SOLVED] Xcode error "Could not find Developer Disk Image"

  • 2015-06-09 15:48:57
  • Nathan Kramer
  • 526178 View
  • 848 Score
  • 22 Answer
  • Tags:   ios iphone xcode

12 Answered Questions

[SOLVED] Good way of getting the user's location in Android

1 Answered Questions

iOS, MKMapView not working properly.

2 Answered Questions

1 Answered Questions

[SOLVED] Human readable location in iOS 6.1

1 Answered Questions

[SOLVED] ipod touch kCLErrorDomain Code=0 Operation Could not be completed

Sponsored Content