Re: Sandboxing question regarding ~/Pictures
Re: Sandboxing question regarding ~/Pictures
- Subject: Re: Sandboxing question regarding ~/Pictures
- From: Sandy McGuffog via Cocoa-dev <email@hidden>
- Date: Mon, 27 Sep 2021 15:41:49 +0200
The sandbox is an enigma wrapped in a mystery. But you might need to look at
the the com.apple.security.assets.pictures.read-write entitlement
> On Sep 27, 2021, at 3:30 PM, Gabriel Zachmann via Cocoa-dev
> <email@hidden> wrote:
>
> 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.
>
> _______________________________________________
>
> 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
_______________________________________________
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