Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Document-scope, Security scoped bookmarks for file packages

I'm trying to create document-scope security scoped bookmarks for file packages. That is, directories where NSURLIsPackageKey is YES. I know you're not normally supposed to be able to create document-scope bookmarks to directories, but I would have expected packages to be exempt from that (after all, I get access to them using an NSOpenPanel which isn't allowed to select directories, but there's no problem there).

I've got my entitlements set up with com.apple.security.files.bookmarks.document-scope = true, and I'm doing a basic bookmark creation call with a file URL that I've just received from an NSOpenPanel (so I have access):

NSError *bookmarkError = nil;
NSData *bookmark = [fileURL 
    bookmarkDataWithOptions:NSURLBookmarkCreationWithSecurityScope
    includingResourceValuesForKeys:nil
    relativeToURL:[self fileURL]
    error:&bookmarkError];

After this call though, both bookmark and bookmarkError are nil.

Do I just need to give up on this and create app-scope bookmarks, even though I have a document-based app? That seems inappropriate, but I don't see another workaround.

like image 221
Tom Harrington Avatar asked Aug 14 '13 02:08

Tom Harrington


1 Answers

I asked about this elsewhere and was told:

...we didn't implement support for it because it's complicated and there have been very few requests for it.

So that's that, you can't create this kind of bookmark because it's not implemented. I also filed a bug with Apple but the response just quoted the docs at me (i.e. telling me stuff I already knew and had mentioned in my report) before closing it. So, as of now and probably for the foreseeable future, this is not possible.

like image 58
Tom Harrington Avatar answered Sep 24 '22 15:09

Tom Harrington