【问题标题】:Is there an App store entitlement for NSAppleScript(source: "do shell script \"sudo" commands?NSAppleScript 是否有 App Store 授权(来源:“do shell script \”sudo”命令?
【发布时间】:2015-05-05 00:32:25
【问题描述】:

例如,我的应用程序在操作系统处理弹出警报时使用以下命令,以请求管理员密码以 root 身份进行身份验证。是否有允许我在沙箱内运行它的权利?

    @IBAction func clearFonts(sender: NSButton) {

    NSAppleScript(source: "do shell script \"sudo atsutil databases -remove;sudo atsutil server -shutdown\" with administrator " +
        "privileges")!.executeAndReturnError(nil)

}

【问题讨论】:

  • 答案是:如果应用程序被沙盒化,则不能这样做,沙盒禁止任意脚本执行。不允许sudo

标签: swift sudo mac-app-store appstore-sandbox nsapplescript


【解决方案1】:

如果应用程序被沙盒化,则不能这样做,沙盒会禁止任意脚本执行。不允许sudo

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-06-11
    • 2013-01-22
    • 2019-03-11
    • 2017-08-09
    • 1970-01-01
    • 2010-10-12
    • 2020-08-28
    • 1970-01-01
    相关资源
    最近更新 更多