Mac OS In App Sandbox Entitlements Directory Read Issue [英] Mac OS In App Sandbox Entitlements Directory Read Issue

查看:71
本文介绍了Mac OS In App Sandbox Entitlements Directory Read Issue的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 App Sandbox 权限有问题.

I am having an issue with my App Sandbox entitlements.

我的 Mac OS 应用程序允许用户打开 XML 文件.解析该文件时,它会读取与 XML 文件位于同一目录中的图像文件.

My Mac OS app allows a user to open an XML file. When that file is parsed it reads a image file in the same directory as XML file.

如果 App Sandbox 为 False,则图片加载正常.如果 App Sandbox 为 True,则图像加载失败.(还在读取XML文件)

If App Sandbox is False, the image loads just fine. If App Sandbox is True, the image fails to load. (The XML file is still read)

App Sandbox 必须为 True 才能推送到 App Store.

The App Sandbox must be True to push to the App Store.

我试过了

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

我从 Apple 的文档中提取了此信息:苹果授权文档

I pulled this information from Apple’s documentation: Apples Entitlement Doc

有什么办法可以同时读取这两个文件?其他人遇到过这样的事情吗?

Is there a way that I can read both files? Anyone else encounter something like this?

此外,这两个文件可以位于用户通常保存文件的任何位置.包括网络驱动器.

Additionally, the two files can be anywhere the user would normally save a file. Including, Network Drives.

推荐答案

com.apple.security.files.user-selected.read-write = TRUE

这是一个布尔值,没关系,权利文件中的 XML 表示是:

this is a Boolean value and it's OK, the XML representation in the entitlements file is:

<key>com.apple.security.files.user-selected.read-write</key>
<true/>

其他 2 个权利不是布尔值,而是字符串数组.所以在权利文件中表示它的正确方法是:

the other 2 entitlements are not Boolean, but arrays of strings. So the correct way to represent it in the entitlements file is:

<key>com.apple.security.temporary-exception.files.home-relative-path.read-only</key>
<array>
    <string>example/local/path1/</string>
    <string>example/local/path2/</string>
</array>
<key>com.apple.security.temporary-exception.files.absolute-path.read-only</key>
<array>
    <string>/usr/local/bin/</string>
    <string>/usr/local/lib/</string>
</array>

这篇关于Mac OS In App Sandbox Entitlements Directory Read Issue的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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