Prompt for root access in cocoa application

笑着哭i 提交于 2020-12-03 18:08:29

问题


I want my program to begin with a prompt/alert that asks for root access. The user must enter their password, and then the application follows. I've been looking around, but I'm not exactly sure how to do this.

You help is greatly appreciated.

Thanks!


回答1:


This is Apple's documentation on the matter, and here is a good example of it.




回答2:


Use BLAuthentication. Its much easier to launch authorization as root and you can enter bash commands to run as root.

http://jim.roepcke.com/blog/archives/2002/09/24/blauthentication-class.html



来源:https://stackoverflow.com/questions/6066864/prompt-for-root-access-in-cocoa-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!