Apple 审查要求我的应用记住用户上次选择的文件夹。但我无法在沙盒下制作它。-setDirectoryURL 似乎在沙盒下不起作用。我该怎么办?感谢您的帮助!
// read string saveFolder from NSUserDefaults
NSOpenPanel * myPanel = [NSOpenPanel openPanel];
[myPanel setTitle:@"Select Output Folder"];
[myPanel setCanChooseDirectories:YES];
[myPanel setCanCreateDirectories:YES];
[myPanel setAllowsMultipleSelection:NO];
[myPanel setCanChooseFiles:NO];
NSLog(@"before openpanel:folder=%@",saveFolder); // <== return normal
[myPanel setDirectoryURL:[NSURL URLWithString:saveFolder.stringValue]];
NSLog(@"readback:folder=%@",[[myPanel URL] path]); // <== return nil here
if ([myPanel runModal] == NSOKButton)
{
//
saveFolder = [[myPanel URL] path]];
// then save the saveFolder string to NSUserDefaults
//
}