允许在Mac OS X App中读取文件的权利是什么?(拒绝文件读取数据错误)

Miu*_*Miu 3 macos cocoa file sandbox file-read

我正在制作一个Mac OS X应用程序(沙盒),它从/ etc / myfolder中已安装的配置文件中读取。当我尝试使用NSFileHandle读取文件时,在控制台中收到以下错误:

sandboxd: ([3251]) MyApp(3251) deny file-read-data /private/etc/myfolder/myconfig.conf

我已在我的Entitilements文件中设置了以下权利,但仍然受到沙盒拒绝。

  • com.apple.security.temporary-exception.files.home-relative-path.read-only
  • com.apple.security.temporary-exception.files.absolute-path.read-only
  • com.apple.security.files.user-selected.read-only

编辑:似乎我滥用了

com.apple.security.temporary-exception.files.absolute-path.read-only

我将其设置为布尔值。我的印象是将其设置为YES将启用使用绝对路径的所有文件读取。上述权利的值必须是允许的绝对路径。

CRD*_*CRD 5

您需要使用com.apple.security.temporary-exception.files.absolute-path.read-only绝对路径/private/etc/myfolder/myconfig.conf-(10.8.3)沙箱似乎不接受/etc/myfolder/myconfig.conf包含符号链接的路径。

注意:如果要为Mac App Store沙箱操作,您可能会面临一项几乎不可能完成的任务,要使您的应用程序具有临时权利,可以读取/ etc中的文件。您最好将此文件存储在应用程序的容器中-在MAS中,每个应用程序都是一个被鲨鱼出没的水包围的小岛。