简体   繁体   中英

CoreLocation issue on High Sierra

I have a command line util the is running in root context (in macOS). This uses CoreLocation to determine the device's location. When this process is launched in High Sierra (in root context), the prompt requesting for user's permission doesn't come up. Also, the process isn't listed in System Preferences -> Privacy pane. Please note that the Command Line Util is signed. However, when the same util is run in user context, it works as expected.

Also, I tried manually editing the clients.plist. When I add the process to the plist, it lists up in System preferences. However, the CoreLocation delegates are not invoked. I see the following error in logs: "Registration timer expired, but client is still registering"

Has apple blocked root processes from collecting location data?

PS: The code is in objective C

It's generally not safe to run Objective-c code as root, code-injection is very easy due to the dynamic nature of the language.

The permission for location access is given by the user, and root has no login account, so the prompt can't appear. You'll either have to enable root login (but see above) or run the location portions of you code in user space and communicate with a system daemon.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM