I need to do some more testing, but I may have a workaround for my problem.
Instead of opening the document via NSDocumentController, ask NSWorkspace to
open the file in my app instead:
{
NSURL* resolvedURL = XXDocumentURLResolvedFromBookmarkData();
[resolvedURL startAccessingSecurityScopedResource];
NSString* appPath = [[NSBundle mainBundle] bundlePath];
BOOL isOpened = [[NSWorkspace sharedWorkspace] openFile:[resolvedURL
path] withApplication:appPath];
[resolvedURL stopAccessingSecurityScopedResource];
}
I imagine NSWorkspaces triggers whatever OSX sandboxing magic is needed to keep
file access intact for the lifetime of the document.
This workaround is pretty straightforward, though it's a little awkward when
the client needs access to the actual NSDocument* afterwards. I'm going to have
to override NSDocumentController's open methods and match up the file URL to
completion handlers I've stashed away somewhere. Not a big deal, but a little
ugly.
Best,
~Martin Wierschin
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]