我在我的应用中使用NSSavePanel
。在我的OS X 10.7上一切正常,但该应用程序被Apple拒绝了,其中有以下评论:
第二次导出时,先前选择的保存位置不起作用。用户必须取消选择该位置,然后再次选择该位置才能写入文件。请确保您拥有必要的权利。
此评论是在运行OS X 10.8的iMac上进行的。
这是我的保存面板代码:
NSSavePanel *savePanel = [NSSavePanel savePanel];
[savePanel setAllowedFileTypes:[NSArray arrayWithObject:@"mov"]];
[savePanel setDirectoryURL:[NSURL URLWithString:@"/Documents"]];
[savePanel setNameFieldStringValue: videoName];
[savePanel beginSheetModalForWindow:window completionHandler:^(NSInteger result){
if (result == NSFileHandlingPanelOKButton) {
NSError *error = nil;
NSString *sourceFilePath = [NSString stringWithFormat:@"%@/%@",[[NSBundle mainBundle] resourcePath], videoName];
NSString *destFilePath = [[savePanel URL] path];
NSFileManager *fileManager = [[NSFileManager alloc] init];
if(![fileManager copyItemAtPath:sourceFilePath toPath:destFilePath error:&error])
NSLog(@"%@", error);
}
}];
目前我正在使用这些标志:
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.assets.movies.read-write</key>
<true/>
<key>com.apple.security.files.downloads.read-write</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
</dict>
我必须使用哪个权利标志来解决此问题?