• 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
Sandboxing: Can't bookmark enclosing folder of user-selected file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sandboxing: Can't bookmark enclosing folder of user-selected file


  • Subject: Sandboxing: Can't bookmark enclosing folder of user-selected file
  • From: Leo <email@hidden>
  • Date: Sun, 22 Dec 2013 04:38:06 -0500

I'm sandboxing an app for the first time. The app has been out for a few years by now, non-sandboxed.

The app receives batches of PDF files and exports them with some changes. Users can select files from NSOpenPanel or drag-and-drop.

There are two options:

-export files into a specific folder, or
-export each file into its original folder.

The first option works with no problem: users select a destination folder in NSOpenPanel, I create and then resolve the bookmark for this folder. Files are being exported there as expected.


However, I'm not sure how to deal with the second option when each file should be exported to its original enclosing folder.

I tried to create a bookmark for file's enclosing folder when users add the files:

NSURL *url = [NSURL fileURLWithPath:[filePath stringByDeletingLastPathComponent]];

            NSData *bookmarkData = [url
                            bookmarkDataWithOptions:NSURLBookmarkCreationWithSecurityScope
                            includingResourceValuesForKeys:nil
                            relativeToURL:nil
                            error:&err];

However, it results in this error: "The file “<enclosing folder name>” couldn’t be opened."

As far as I understand, it happens because user selects the file, which still doesn't grant the right to bookmark its enclosing folder.


If I create a bookmark for file's URL, I can't use this bookmark to export the file: the bookmark doesn't grant permissions to the enclosing folder.


I did some extensive research and experimented with different options with no luck.


What am I missing? How can I bookmark the enclosing folder of user-selected file (if at all)?


Any help will be appreciated!


Thanks,
Leo

_______________________________________________

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: Sandboxing: Can't bookmark enclosing folder of user-selected file
      • From: Mike Abdullah <email@hidden>
  • Prev by Date: Re: How to accept drag of a URL on the dock icon?
  • Next by Date: Re: CALayer's delegate prevents implicit animation?
  • Previous by thread: Re: How to accept drag of a URL on the dock icon?
  • Next by thread: Re: Sandboxing: Can't bookmark enclosing folder of user-selected file
  • Index(es):
    • Date
    • Thread