• 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 question regarding ~/Pictures
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sandboxing question regarding ~/Pictures


  • Subject: Sandboxing question regarding ~/Pictures
  • From: Gabriel Zachmann via Cocoa-dev <email@hidden>
  • Date: Mon, 27 Sep 2021 15:30:53 +0200

I guess i still haven't understood something about sandboxing or entitlements.

I am trying to access the user's ~/Pictures folder, and also create a
security-scoped bookmark (SSB) for that folder.

Under the target's Signing & capabilities section, File Access Type, I have set
"Pictures Folder" to read/write.

Getting the path using this
        NSURL * pic_dir = [ [NSFileManager defaultManager] URLForDirectory:
NSPicturesDirectory
                                                                  inDomain:
NSUserDomainMask
                                                         appropriateForURL: nil
create: NO error: &err];

and doing a spotlight search over the folder works just fine.

However, creating a SSB for pic_dir does not work.

I am trying to create it like this:

        NSData * dir_bookmark = [dir bookmarkDataWithOptions:
NSURLBookmarkCreationWithSecurityScope
                               includingResourceValuesForKeys: nil
                                                relativeToURL: nil
                                                        error: &systemError];

But I get this error:

Error Domain=NSCocoaErrorDomain Code=256 "Could not open() the item"
UserInfo={NSURL=file:///Users/zach/Library/Containers/de.zach.ArtSaverApp/Data/Pictures/,
 NSDebugDescription=Could not open() the item}!


All of this is happening under macOS 11.5.2 .

Any insights will be highly appreciated.
G.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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 question regarding ~/Pictures
      • From: Sandy McGuffog via Cocoa-dev <email@hidden>
  • Prev by Date: Accessing ~/Pictures under Mojave from screensaver ?
  • Next by Date: Re: Sandboxing question regarding ~/Pictures
  • Previous by thread: Accessing ~/Pictures under Mojave from screensaver ?
  • Next by thread: Re: Sandboxing question regarding ~/Pictures
  • Index(es):
    • Date
    • Thread