简体   繁体   English

macOS 授予对沙盒应用程序的全盘访问权限不起作用

[英]macOS Granting full-disk access to sandboxed app not working

I'm experimenting with full-disk access and can't make it working.我正在尝试全盘访问,但无法正常工作。 Here is list of steps I did:这是我执行的步骤列表:

  1. Sandbox is turned ON.沙盒已打开。 In fact the entitlements file looks like:事实上,权利文件看起来像:
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.bookmarks.app-scope</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
  1. I created archive of the app and tried to distribute it using boths Developer ID or Development methods我创建了应用程序的存档并尝试使用开发人员 ID开发方法分发它
  2. I placed the binary of my app to /Applications folder我将我的应用程序的二进制文件放在/Applications文件夹中
  3. I went to System Preferences -> Security & Privacy -> Privacy -> Full Disk Access and added access to my app in /Applications folder我去了System Preferences -> Security & Privacy -> Privacy -> Full Disk Access并在/Applications文件夹中添加了对我的应用程序的访问权限
  4. Of course I'm NOT attached to the app with Xcode当然,我没有使用Xcode附加到应用程序

I'm testing it in Xcode 11 and on Catalina.我正在 Xcode 11 和 Catalina 上对其进行测试。 It's dummy app, opening NSOpenPanel to let user select archives to decompress and tries to decompress it in the same directory.它是一个虚拟应用程序,打开NSOpenPanel让用户 select 档案解压并尝试在同一目录中解压。

In fact it's not about NSOpenPanel , the question is:事实上,这与NSOpenPanel ,问题是:

What is necessary to do to make sandboxed app using full-disk access?使用全磁盘访问制作沙盒应用程序需要做什么?

Any hints?有什么提示吗? Am I doing anything wrong?我做错什么了吗?

Here is solution found for iTerm2 (it is worth read how solution was found).这是为 iTerm2 找到的解决方案(值得一读如何找到解决方案)。 It just adds this to application plist:它只是将其添加到应用程序 plist 中:

<key>NSSystemAdministrationUsageDescription</key>
<string>I want to read all your files</string>

Documentation is a bit fuzzy. 文档有点模糊。

Sadly this solution doesn't work for launchctld daemons (this is what I need).遗憾的是,这个解决方案不适用于launchctld守护进程(这是我需要的)。 I think daemons are an exception since the do not see UI at all.我认为守护进程是一个例外,因为它根本看不到 UI。

But for regular applications it should work like a charm (didn't test it yet).但是对于常规应用程序,它应该像魅力一样工作(尚未测试)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM