Hi all.

I have a simple cocoa app (Mac OS X 10.9) that must install (or remove) a 
framework to system/library/Frameworks. It seems to need permission to do that, 
as the NSFileManager copyItemAtPath method returns error 513 
(NSCocoaErrorDomain/SFileWriteNoPermissionError).
So I tried to get authorization with:

OSStatus status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, 
kAuthorizationFlagDefaults, &myAuthorizationRef);
if (status != errAuthorizationSuccess) {
    AuthorizationItem right = {kAuthorizationRightExecute, 0, NULL, 0};
    AuthorizationRights rights = {1, &right};
    AuthorizationFlags flags = kAuthorizationFlagDefaults | 
kAuthorizationFlagInteractionAllowed | kAuthorizationFlagPreAuthorize | 
kAuthorizationFlagExtendRights;
    status = AuthorizationCopyRights(myAuthorizationRef, &rights, NULL, flags, 
&rights2);
}

status is errAuthorizationSuccess, but copyItemAtPath method still returns 
error 513.

I tried to change the AuthorizationItem fields, but without success.

Any idea? I googled a lot but without success either.

Thank you all in advance,
bedt regards,
livio.
_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to