3

サンドボックスコンテナ内のフォルダを Finder で開きたいのですが、うまくいきません。これは私のコードです。

- (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]];
}

そして、コンソールにこのエラーメッセージが表示されました。

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

フォルダーはサンドボックス コンテナーにあり、サンドボックス化されたアプリによって作成されたもので、ファイルを書き込むことができるので、読み取り権限が必要だと思います。このフォルダを Finder で手動で作成した場合、NSWorkspace を使用して正常に開くことができます。とても奇妙です。

私のコードの何が問題なのですか、または Mac App Sandbox で Finder を使用してフォルダーを開く別の方法はありますか?

4

0 に答える 0