SMJobBless Apple sample code keep asking password

274 views Asked by At

I have downloaded the Apple's SMJobBless to execute privileged operation. It is working correctly. The only issue i'm facing is, every time on launch it asks for password. Is there a way to avoid this thing?

Thanks

2

There are 2 answers

0
kevin On

You are probably running the code to install the helper tool every single time your application runs. You should check to see if the helper is installed before you run the code to install the helper. The easiest way is to try and connect to it with a GetVersion command and check the return of that.

0
Joshua Kaplan On

You may want to take a look at SwiftAuthorizationSample which provides a basic GUI with an explicit button to perform an install. If you look at the determineStatus function you can see how to determine if/to what extent the helper tool is installed and use that to decide whether to prompt for install.