沙盒和目录列表

时间:2011-08-06 08:59:23

标签: cocoa macos sandbox nsfilemanager osx-lion

我所做的一项常见任务是使用NSFileManager读取目录内容:contentsOfDirectoryAtPath但在Lion中启用沙盒这是不可能的。

我知道用户必须从NSOpenPanel中选择目录以使Sandbox满意(或删除它)但是如何“通知”沙箱我必须从以前存储在某些配置文件中的路径读取目录而无需用户交互?

目前我已设置以下授权密钥

com.apple.security.files.user-selected.read-write
com.apple.security.documents.user-selected.read-write
com.apple.security.temporary-exception.files.absolute-path.read-write

1 个答案:

答案 0 :(得分:5)

沙箱当前不记得在应用程序启动之间允许在文件系统上访问的内容。

Apple在一些高优先级雷达上对此进行了跟踪,但我仍然建议您提交自己的错误报告,以提高其在Apple内的认知度。