Following is my JobBless code, I need help in finding out the error specifically when user cancels the Helper tool installation password dialog
var authorization: AuthorizationRef?
let status: OSStatus = AuthorizationCreate(nil, nil, [], &authorization)
guard status == errAuthorizationSuccess else {
return .failure(authFailed)
}
var error: Unmanaged<CFError>?
let blessStatus = SMJobBless(kSMDomainSystemLaunchd, label as CFString, authorization, &error)
guard blessStatus else {
//*** CHECK FOR CFERROR TO SEE WHETHER THE FAILURE IS DUE TO USER CANCELLING
// THE PASSWORD REQUEST**
print(error)
return .failure(blessfailed)
}
return .success(())
I get the following error printed:
Error Domain=CFErrorDomainLaunchd Code=2
I expected kSMErrorLaunchDeniedByUser (11), but I received kSMErrorInternalFailure(2). I am not sure whether I am looking into the right error enum. Please help.
(lldb) p kSMErrorLaunchDeniedByUser
(Int) $R0 = 11
(lldb) p kSMErrorInternalFailure
(Int) $R1 = 2
The reason I want this error number is to show an error screen if user cancels the dialog instead of entering the password. Please help
Blessed
framework to wrap a bunch of these shitty APIs. The author has done a pretty thorough job of detecting all the various error conditions and reporting them in a more sensible way. Perhaps you can look into how he handles this case. As a last resort, you could try a Technical Support Incident – Statolatry