允许在Mac OS X应用程序中读取文件的权限是什么? (拒绝文件读取数据错误) [英] What is the entitlement to allow reading of file in a Mac OS X App? (deny file-read-data error)

查看:3104
本文介绍了允许在Mac OS X应用程序中读取文件的权限是什么? (拒绝文件读取数据错误)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am making a Mac OS X App (sandboxed) which reads from an installed config file in /etc/myfolder. When I am trying to read the file using NSFileHandle, I am getting the following error in Console:

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

我在我的Entitilements文件中设置了以下权利,但我仍然被sandboxd拒绝。

I have set the following entitlements in my Entitilements file, but I still get denied by sandboxd.


  • 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将启用使用绝对路径的所有文件读取。上述授权的值必须是允许的绝对路径。

I set it as a Boolean. I was under the impression that setting it to YES will enable all file reads using absolute paths. The value of the above entitlement must be the absolute path that will be permitted.

推荐答案

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

You need to use com.apple.security.temporary-exception.files.absolute-path.read-only and the absolute path /private/etc/myfolder/myconfig.conf - the (10.8.3) sandbox doesn't seem to accept the /etc/myfolder/myconfig.conf path containing the symbolic link.

注意:如果你是Mac应用商店的沙箱,你可能会面临几乎不可能的任务让你的应用程序接受临时权利读取/等等你最好把这个文件存储在应用程序的容器中 - 在MAS中,每个应用程序都是被鲨鱼侵染的水域包围的岛屿。

Note: If you are sandboxing for the Mac App Store you will probably face a near impossible task getting your app accepted with a temporary entitlement to read files in /etc. You would be better off storing this file in your app's container - in the MAS every app is an island surrounded by shark infested waters.

这篇关于允许在Mac OS X应用程序中读取文件的权限是什么? (拒绝文件读取数据错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆