我正在编写一个应用程序,目前处于工作流程中:
-File A doesn't exist?
-Copy file B to file A
-Error?
-Copy file B to file A with higher privileges
问题出在“以更高权限将文件 B 复制到文件 A”步骤中。我刚开始向管理员询问他/她的密码。我想要一个与此类似的窗口,管理员可以在其中输入密码,以便将文件复制到其他不可写的位置:
我完全不知道从哪里开始,有人可以帮助我吗?谢谢! :D
最佳答案
你可以使用AuthorizationExecuteWithPrivileges()
参见here for an example和here for the full code to 'OSXSlightlyBetterAuth' .
关于objective-c - 将文件复制到应用程序可能无法写入的目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3894720/