Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: How to utilize Mac OS X NSURL.h resources?


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0
Grant Beattie

Posts: 77
Registered: 11/29/01
How to utilize Mac OS X NSURL.h resources?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 18, 2014 3:03 PM
I imagine this also applies to iOS and both Delphi/C++.

I am trying to use TNSOpenPanel to get access to a user specified path from within the sandbox. The requires me to save/read-back a bookmark URL for the openpanel. The normal way to do this appears to be:
- get the path the user specifies (it's actually a URL)
- save this to a bookmark
Later I can get this bookmark and use it to get back to the user specified path.

Where it gets ugly is that there are no API's or headers or anything that I can find that get me down to this level. Here are some pieces that seem to be missing (for example):

a definition for NSURLBookmarkCreationWithSecurityScope

The local Macapi.Foundation.hpp on the dev PC has some of the related values:
static const System::Word NSURLBookmarkCreationMinimalBookmark = System::Word(0x200);
static const System::Word NSURLBookmarkCreationPreferFileIDResolution = System::Word(0x100);
static const System::Word NSURLBookmarkCreationSuitableForBookmarkFile = System::Word(0x400);


And by looking on the Mac in System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSURL.h I can see enough to get me going:

NSURLBookmarkCreationPreferFileIDResolution NS_ENUM_DEPRECATED(10_6, 10_9, 4_0, 7_0) = ( 1UL << 8 )
NSURLBookmarkCreationMinimalBookmark = ( 1UL << 9 ),
NSURLBookmarkCreationSuitableForBookmarkFile = ( 1UL << 10 ), 
NSURLBookmarkCreationWithSecurityScope NS_ENUM_AVAILABLE(10_7, NA) = ( 1 << 11 ), /* allows sandboxed process to access resource after being relaunched */


So I made my own up for NSURLBookmarkCreationWithSecurityScope (0x800). But now I need to get a hold of startAccessingSecurityScopedResource and stopAccessingSecurityScopedResource. And this I cannot figure out. It seems Embarcadero headers are incomplete and/or it's a bit out of my abilities to resolve this. Has anyone made use of these API's? It seems more and more people will fall into this as the sandboxing requires it for some functionality.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02