【发布时间】:2015-10-06 21:37:19
【问题描述】:
我正在尝试从沙盒应用程序执行帮助应用程序,但它抛出错误 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)
}
是我做错了什么,还是在沙盒中不可能?
【问题讨论】:
-
你的助手也被沙盒化了吗?当沙盒不存在时,该示例代码来自 10.6
标签: macos swift sandbox smjobbless