SFAuthorization KAuthorizationEnvironmentIcon setting not working
SFAuthorization KAuthorizationEnvironmentIcon setting not working
- Subject: SFAuthorization KAuthorizationEnvironmentIcon setting not working
- From: David Garcea <email@hidden>
- Date: Thu, 18 Jan 2007 15:47:01 -0800
- Thread-topic: SFAuthorization KAuthorizationEnvironmentIcon setting not working
I'm trying to customize an authorization dialog so that it is clear that it
is part of our application. I've been able to add an appropriate message to
it using the kAuthorizationEnvironmentPrompt tag, but I can't seem to get it
to use the icon for our application instead of the generic document icon.
Here's the relevant code:
[snip]
// We are about to attempt to obtain administrative rights.
SFAuthorization *authorization = [SFAuthorization authorization];
// Configure the dialog that asks the user for their password to contain our
// icon and an appropriate message.
NSString *prompt = NSLocalizedString( @"AuthorizationRequestMessage", nil);
NSString *pathToIcon = [[NSBundle mainBundle]
pathForImageResource:@"appicon128.png"];
AuthorizationItem dialogConfiguration[2] = {
{kAuthorizationEnvironmentIcon, [pathToIcon length], (void*) [pathToIcon
UTF8String], 0},
{kAuthorizationEnvironmentPrompt, [prompt length], (void*) [prompt
UTF8String], 0}
};
AuthorizationEnvironment authorizationEnvironment = {2,dialogConfiguration};
// Specify the rights we want.
AuthorizationItem desiredRight = { kAuthorizationRightExecute, 0, NULL, 0};
AuthorizationRights desiredRights = { 1, &desiredRight};
// Ask the user to authenticate as an administrator.
if( ![authorization permitWithRights:&desiredRights
flags:(kAuthorizationFlagDefaults | kAuthorizationFlagInteractionAllowed |
kAuthorizationFlagExtendRights) environment:&authorizationEnvironment
authorizedRights:NULL] )
[snip]
According to the "Authorization Services C Reference", the
KAuthorizationEnvironmentIcon "Specifies the name of the authorization item
that should be passed into the environment when specifying an alternate
icon. The value should be a full path to an image compatible with the
NSImage class."
I've tried both PNG and TIFF files, which I know are compatible with
NSImage. I've also tried passing in an ASCII C string instead of a UTF8
string, but that doesn't work either. [[NSBundle mainBundle]
pathForImageResource:] is returning an absolute path.
Any assistance is appreciated.
Regards,
David
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden