Hello,
I am trying to customize the Authorization dialog with custom icon and text. I am using the following code:
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.
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] )
{
}
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.