0

I want to show current location of user, Sometimes it works fine but sometimes does not. when it does not work, I got this error message : Error Domain=kCLErrorDomain Code=0 " The operation couldn’t be completed. (kCLErrorDomain error 0.) I have read this solution [enter link description here][1] and this to fix this issue answered by MeM and also tried other solutions but did not work every time.

[1]: didFailWithError: Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error 0.)" . It does not work every time. How to fix this issue permanently. Any suggestion will be great. Thanks in advance.

Community
  • 1
  • 1
Ravi
  • 800
  • 2
  • 12
  • 28
  • I think you might want to take a step back and think about the design of the app. What do you want your app to do if the current location of the user cannot be obtained? Quit? Put up a spinning Activity Indicator? Display an Alert saying the app cannot continue? Or that the user should close the app and try again later? Once you make this decision, then you can implement it wherever you check for this error. – GlennRay Dec 21 '15 at 23:55

1 Answers1

0

I recommend you to follow the following the steps:

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

if you do then

  • go to settings and reset your location services
  • reset your network settings
casillas
  • 16,351
  • 19
  • 115
  • 215
  • @ Casillas, I have already done this (I have already mention in my question), after doing these steps, it does not work properly. Have you another solution? – Ravi Dec 21 '15 at 19:27
  • I do not have anything in my mind, if you share your code, that might be more informative. – casillas Dec 21 '15 at 19:29
  • **Finally fixed this issue.** (1). Reset location services + network settings (2) add NSLocationAlwaysUsageDescription or NSLocationWhenInUseUsageDescription key in Info.plist with a message to be displayed in the prompt. with your string which you want to show (3)Clean project (4) delete app from iphone and run again (if require) – Ravi Dec 22 '15 at 05:34
  • That is the reason I recommended you to put the code then we could investigate further. – casillas Dec 22 '15 at 19:32