Mac OS Command Line Location Services

I wrote a simple program that uses Cocoa definition services to get the user's current position. It works without problems on a MacBook Pro. However, this is not on a MacBook Air.

I stayed with the code Operation could not be completed. (kCLErrorDomain error 1.) Operation could not be completed. (kCLErrorDomain error 1.) , and I have already tried to fix many things (for example, setting permissions). By checking the box for the application in the privacy settings to enable location services for the application, it disappears as soon as I launch the application.

To initialize the services, I use the startUpdatingLocation method of the startUpdatingLocation class.

Is there any way to solve the problem?

+4
source share
2 answers

The answer is trivial - I forgot to set permissions for the executable file that is launched by the plist file in / Library / LaunchDaemons /. Simple chmod 007 solves the problem.

+2
source

kCLErrorDomain error 1 means that you were denied access to location services. Most likely they were disabled. See Disable Location Services . If you go to System Preferences → Security → Privacy, select the Allow the location of services that you can check box. In addition, the authorizationStatus method of the class returns the status of your current access to location services. This condition is defined as the following enumeration:

 typedef enum { kCLAuthorizationStatusNotDetermined = 0, //user hasn't allowed/denied kCLAuthorizationStatusRestricted, //app level restriction, cannot be lifted by user kCLAuthorizationStatusDenied, //explicit user denial, or disabled in settings kCLAuthorizationStatusAuthorized //self explanitory } CLAuthorizationStatus; 

Hope this helps you. My only advice besides this, since I did not use the location services myself, you read the documentation and hopefully find something that helps.

+1
source

All Articles