• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Get write authorization
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Get write authorization


  • Subject: Get write authorization
  • From: Livio Isaia <email@hidden>
  • Date: Mon, 18 Nov 2013 07:41:34 +0100

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 (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Get write authorization
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: Stale xib files
  • Next by Date: Re: Get write authorization
  • Previous by thread: Re: Displaying untrusted certificate information in iOS app
  • Next by thread: Re: Get write authorization
  • Index(es):
    • Date
    • Thread