Re: Questions about sandboxing under Catalina
Re: Questions about sandboxing under Catalina
- Subject: Re: Questions about sandboxing under Catalina
- From: Gabriel Zachmann via Cocoa-dev <email@hidden>
- Date: Fri, 10 Jan 2020 14:36:03 +0100
Steve, thanks a lot for your response!
>>
>> In my screensaver, I try to search the Pictures directory in the user's home.
>> It is OK - for now - if my app cannot access any .photoslibrary, but I'd
>> like to pick up
>> any other images in ~/Pictures.
>>
>> I get the path using this line of code:
>> [NSHomeDirectory() stringByAppendingPathComponent: @"Pictures/"]
>>
>> However, when I print the actual path to the system log, it says it is
>> accessing this path:
>>
>> /Users/me/Library/Containers/com.apple.ScreenSaver.Engine.legacyScreenSaver/Data/Pictures
>>
>> Is this directory somehow linked to ~/Pictures ?
>> Or how can I access the true ~/Pictures directory ?
>
> That's how sandboxing works.
So, is .../Containers/.../Data/Pictures linked to ~/Pictures automatically?
I am searching that directory (if the user did not specify any other directory)
for images using Spotlight.
Apparently, Spotlight starts delivering images to my screensaver, and at some
point it gets killed or hangs. I was wondering if that happens when Spotlight
tries to deliver images from the Photos database (which is also stored in
~/Pictures).
> My image-based screensaver works the same way, although the folders need to
> be chosen by the user,
My screensaver has that feature, too.
> which ensures it has access to the files within,
Do I have to do anything special to ensure that?
Currently, I am using this very simple code:
- (IBAction) selectDirectory: (id) __attribute__ ((unused)) sender
{
NSOpenPanel *oPanel = [NSOpenPanel openPanel];
long int result;
[oPanel setAllowsMultipleSelection: NO];
[oPanel setCanChooseDirectories: YES];
[oPanel setCanChooseFiles: NO];
[oPanel setDirectoryURL: [NSURL URLWithString: directoryLocation_]];
result = [oPanel runModal];
if ( result != NSModalResponseOK )
return;
NSURL * url = [[oPanel URLs] objectAtIndex: 0];
NSString * aDir = [url path];
...
> and I store security-scoped bookmark data for each url they choose.
How do I do that? how would I use such url's?
Could you explain this a bit further, or maybe you can provide a pointer where
I can read up on this?
Best regards, Gabriel
_______________________________________________
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