Hello,
I have Cocoa application, which have to store global settings, so I
use CFPreferences...(..., kCFPreferencesAnyUser,
kCFPreferencesCurrentHost).
Everything was ok while I launched application as admin user, but when
I switched to limited user, settings changes were not saved.
I have found that I should use Security.framework. Then I wrote code
below, it shows authentication dialog for limited user, but settings
still not saving for limited user.
What do I do wrong? Could you advise me how to fix code?
extern OSStatus AcquireRight(const char *rightName)
{
OSStatus err;
static const AuthorizationFlags kFlags =
kAuthorizationFlagInteractionAllowed
| kAuthorizationFlagExtendRights;
AuthorizationItem kActionRight = { rightName, 0, 0, 0 };
AuthorizationRights kRights = { 1, &kActionRight };
assert(gAuthorization != NULL);
// Request the application-specific right.
err = AuthorizationCopyRights(
gAuthorization, // authorization
&kRights,
// rights
kAuthorizationEmptyEnvironment, // environment
kFlags,
// flags
NULL
// authorizedRights
);
return err;
}
...
OSStatus err = AuthorizationCreate(NULL, NULL, 0, &gAuthorization);
err = AcquireRight("system.preferences");
CFPreferencesSetValue(CFSTR("jpegCompressionFactor"),
(CFNumberRef)jpegCompression, CFSTR(MFSDomainName),
kCFPreferencesAnyUser,
kCFPreferencesCurrentHost);
CFPreferencesSynchronize(CFSTR(MFSDomainName), kCFPreferencesAnyUser,
kCFPreferencesCurrentHost);
...
---
BR, Alexander
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com