macos - 带助手应用程序的沙盒应用程序

标签 macos swift sandbox smjobbless

我正在尝试从沙盒应用程序执行助手应用程序,但它抛出错误 errAuthorizationDenied (-60005),我使用的是 Apple SMJobBless作为例子。目前我有这个

var authItem: AuthorizationItem = AuthorizationItem(name: kAuthorizationRightExecute, valueLength: 0, value: nil, flags: 0)
var authRights: AuthorizationRights = AuthorizationRights(count: 1, items: &authItem)
let authFlags: AuthorizationFlags = AuthorizationFlags.ExtendRights
var result = false
var authRef: AuthorizationRef = nil

let status: OSStatus = AuthorizationCreate(&authRights, nil, authFlags, &authRef)
if status == errAuthorizationSuccess {
    result = SMJobBless(kSMDomainSystemLaunchd, "**helperBundleIdentifier**", authRef, nil)
}

我是不是做错了什么,或者在沙盒中是不可能的?

最佳答案

来自沙盒 guide

The following app behaviors are incompatible with App Sandbox:

Use of Authorization Services

关于macos - 带助手应用程序的沙盒应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32980194/

相关文章:

php - 如何在 Zend Framework 1.12 中集成 paypal?

cocoa - 使用 xcode 4 但针对 OSX Leopard (10.5) 及更高版本

CSS 代码适用于 Mac 浏览器但不适用于 Windows 浏览器?

c++ - 在Mac OS X 10.8上编译并使用boost 1.51.0

swift - 在 switch 之外访问 swift 枚举案例?

swift - 找不到接受提供的参数的 "init"的重载(swift)

xcode - 如何返回 App Temp 目录

java - 将桌面应用程序移植到 Applet 沙箱

javascript - Web 应用程序中的 Mac 多点触控

ios - 奇怪的 Swift XCode 'Undefined Symbols' 错误