Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

McBgnr

macrumors regular
Original poster
Apr 13, 2009
144
0
Hello,

I am trying to customize the Authorization dialog with custom icon and text. I am using the following code:

Code:
	SFAuthorization *authorization = [SFAuthorization authorization];
 
	NSString *pathToIcon = [[NSBundle mainBundle]pathForImageResource:@"unchecked.png"];
 
	AuthorizationItem dialogConfiguration[2] = {
		{kAuthorizationEnvironmentIcon, [pathToIcon length], (void*) [pathToIcon
																	  UTF8String], 0},
		{kAuthorizationEnvironmentPrompt, [prompt length], (char *) [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] )
	{
	}
Although the text is getting loaded, but the icon is not getting loaded. I am not sure what could be the reason for this. Any pointers will be very helpful. I want the icon to be shown on the LockIcon and in the Details sections.

I have tried using const char * type string in place of NSString for pathToIcon. But that did not work either... any hints, suggestions are welcome.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.