Cla*_*law 2 macos sandbox swift 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)
}
Run Code Online (Sandbox Code Playgroud)
我做错了什么,还是在沙箱中不可能?
| 归档时间: |
|
| 查看次数: |
441 次 |
| 最近记录: |