MacOS:使用Finder Sync Extension中的getxattr / setxattr

时间:2018-04-27 23:11:18

标签: macos finder appstore-sandbox entitlements xattr

我想在OSX 10.12.6上使用来自Finder Sync Extension的setxattr / getxattr,但调用失败,错误为errno == 1,即EPERM。 Finder同步扩展在沙箱中运行,所以我想我需要请求权限。到目前为止,没有任何谷歌搜索和文档浏览发现的信息。 我想要访问的文件由我自己拥有,使用xattr命令行实用程序设置属性会成功并产生预期的结果。

所以问题是:我需要哪些权限/权利才能提供沙箱,或者这是否可能?

我基本上希望将同步状态存储在扩展属性中(清理,修改,同步),并根据需要为requestBadgeIdentifierForURL选择正确的徽章。优先级较低的非沙盒进程会遍历文件并更新属性。

另一种方法是使用一个单独的数据库来存储同步状态,如果xattr没有用完,我将使用它。

编辑:添加了权利文件

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.app-sandbox</key>
    <true/>
    <key>com.apple.security.temporary-exception.files.absolute-path.read-write</key>
    <true/>
    <key>com.apple.security.temporary-exception.files.home-relative-path.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>
</plist>

示例附带的原始权利文件只是

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

也不起作用。

我向GitHub添加了一个测试项目https://github.com/JensRestemeier/SyncExtensionTest

0 个答案:

没有答案