SMJobBless has a dialog prompt that tells the user it is installing a helper tool and to type password to proceed. I would like to change the text.
Instead of changing the text, the following code puts my custom text at the beginning and still displays the default text. What am I missing or doing wrong?
// Creating auth item to bless helper tool and install framework
AuthorizationItem authItem = {kSMRightBlessPrivilegedHelper, 0, NULL, 0};
// Creating a set of authorization rights
AuthorizationRights authRights = {1, &authItem};
NSString *promptText = @"Customized Text. Privilege?\n\n";
AuthorizationItem dialogConfiguration[1] = { kAuthorizationEnvironmentPrompt, [promptText length], (char *) [promptText UTF8String], 0 };
AuthorizationEnvironment authorizationEnvironment = { 0 };
authorizationEnvironment.items = dialogConfiguration;
authorizationEnvironment.count = 1;
// Specifying authorization options for authorization
AuthorizationFlags flags = kAuthorizationFlagDefaults | kAuthorizationFlagInteractionAllowed | kAuthorizationFlagExtendRights;
// Open dialog and prompt user for password
OSStatus status = AuthorizationCreate(&authRights, &authorizationEnvironment, flags, authRef);`
使用kAuthorizationRightExecute代替kSMRightBlessPrivilegedHelper将获得仅要求输入密码的短文本。并使用kAuthorizationEnvironmentPrompt,因为环境可以在提示的开头添加其他文本。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.