3

I want to open a folder in sandbox container with Finder, but can't get it working. This is my code.

- (IBAction)buttonClicked:(id)sender
{
    NSString *folder = [NSHomeDirectory() stringByAppendingPathComponent:@"Backup"];
    [[NSFileManager defaultManager] createDirectoryAtPath:folder withIntermediateDirectories:YES attributes:nil error:NULL];
    [[NSWorkspace sharedWorkspace] openURL:[NSURL fileURLWithPath:folder]];
}

And I got this error message in Console.

CoreServicesUIAgent: Quarantine resolution refused to pid 4288 because it is not allowed to read /Users/username/Library/Containers/com.domain.bundle/Data/Backup

The folder is in sandbox container, it was created by my sandboxed app and I can write files into it, so I think I should have read permission. If I created this folder manually with Finder, then I can open it successfully using NSWorkspace. It's so strange.

What's wrong with my code or is there another way to open folder with Finder in Mac App Sandbox?

4

0 回答 0