Re: Get write authorization

2013-11-18 Thread Kyle Sluder
 On Nov 17, 2013, at 11:35 PM, Livio Isaia lis...@tiscalinet.it wrote:

 
 
 On Sun, Nov 17, 2013, at 10:41 PM, Livio Isaia wrote:
 Hi all.
 
 I have a simple cocoa app (Mac OS X 10.9) that must install (or remove) a
 framework to system/library/Frameworks.
 
 Why? /System is for OS-provided components only. You should only install
 your frameworks to /Library/Frameworks.
 
 --Kyle Sluder
 
 Because the apps that need the framework seem not to find it there…
 
 May be they need a particular search path specification when building?

Yes, they do.

When an app is built, the search path for each of its dynamically linked 
libraries is copied from the library it’s linked against and baked into the 
app’s load commands.

Thus, to influence where the app looks for its libraries, it is necessary to 
modify the Install Name of the library. You can find this setting in the Build 
Settings pane of your library’s target, or you can modify it after the fact 
using install_name_tool.

There are special tokens that make the install name very powerful: 
“@executable_path”, “@loader_path,” and “@rpath.” These are documented at the 
bottom of the dyld man page.

The bottom line is that if you correctly configure your library target, then 
rebuild your app against these properly-configured libraries, your app will be 
able to find them in any reasonable spot at launch time—most preferably inside 
your app bundle.

--Kyle Sluder
___

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

Re: Get write authorization

2013-11-18 Thread Livio Isaia


 
 Il giorno 18/nov/2013, alle ore 10:11, Kyle Sluder k...@ksluder.com ha 
 scritto:
 
 Is there any reason your frameworks can't live inside the app bundle?
 
 --Kyle Sluder
 
 yes, you’re right, but the fact  is that I don’t know how to put the 
 framework inside the app bundle with xcode 5… I googled at the time, but… (it 
 seems I’m not too lucky with google)
 
 livio.

By the way, what if I put the framework in $(USER_LIBRARY_DIR)/Frameworks?

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

Re: Private Framework Was: Get write authorization

2013-11-18 Thread Jerry Krinock

On 2013 Nov 18, at 01:47, Livio Isaia lis...@tiscalinet.it wrote:

 By the way, what if I put the framework in $(USER_LIBRARY_DIR)/Frameworks?

Then you will be able to install it without the access issues (assuming you’re 
not sandboxed).  But it will be a permanent maintenance headache.

Instead, heed Kyle’s advice and put it in your application package.  Kyle gave 
you all of the keywords you need to search for.


___

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

Get write authorization

2013-11-17 Thread Livio Isaia
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

Re: Get write authorization

2013-11-17 Thread Kyle Sluder
On Sun, Nov 17, 2013, at 10:41 PM, Livio Isaia wrote:
 Hi all.
 
 I have a simple cocoa app (Mac OS X 10.9) that must install (or remove) a
 framework to system/library/Frameworks.

Why? /System is for OS-provided components only. You should only install
your frameworks to /Library/Frameworks.

--Kyle Sluder
___

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

Re: Get write authorization

2013-11-17 Thread Livio Isaia

 On Sun, Nov 17, 2013, at 10:41 PM, Livio Isaia wrote:
 Hi all.
 
 I have a simple cocoa app (Mac OS X 10.9) that must install (or remove) a
 framework to system/library/Frameworks.
 
 Why? /System is for OS-provided components only. You should only install
 your frameworks to /Library/Frameworks.
 
 --Kyle Sluder

Because the apps that need the framework seem not to find it there…

May be they need a particular search path specification when building?

Thanks,
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