Posts

Post marked as solved
11 Replies
10k Views
I had an application that needs to do very frequent privileged work.I used to achieve these work by AuthorizationExecuteWithPrivileges(). And I would like to follow the recommended way by using SMJobBless with XPC (a privileged helper over XPC communication). However, I got 2 questions about the unstalling the privileged helper (helper for short below).I noticed that SMJobRemove had been marked as deprecated and there is no other API as replacement of it now. So I would like to understand what is the supposed or recommended approach to unstall the helper now?More background of this question:My application can be installed by a simple drag from with the dmg packege. And the uninstall process is also just by draging to the Trash.The first time the app starts, it will try to bless the helper with asking the authentication/authorization from a user. Subsequently, it will not bother users next time startup or when communicating with the helper for privileged works.The reason that I need to uninstall the helper is for the helper version compatibility. There could be multiple versions of the application with potential different version of helpers co-existing in a user's system. So an idea is that each application with an exactly version number will install and communicate with a helper with a specified version as well (i.e. application 1.0.0 <-> helper-100 / application 2.0.1 <-> helper-201 ...). Therefore, to avoid leaking such a number of helpers in the disk when the applications are removed, I would like to unstall (remove) the helper[ver_num] when a specific version of applications are removed.Furthermore, when to trigger the uninstall process?My current idea is that when the first time the application starts, it will register the folder path where the application is in in the helper (over XPC) plist. The helper will then watch the folder change over the paths (if there are multi applications with that version exists). Once all the applications of that version with different paths registered in helper are removed, the helper will fork a subprocess to uninstall the helper (by SMJobRemove??).If the above thinking are not on a correct direction, could you have any suggestion about these 2 questions?
Posted Last updated
.