背景
我有一个守护进程可以跟踪系统上的所有事件。 要正常工作,它需要“完全磁盘访问”。
问题
如果用户手动将守护进程添加到“首选项/保护和隐私/隐私/完整磁盘访问”列表中,一切都会按预期进行。问题是我的应用程序是一个守护进程,因此它无权访问 UI。因此,当它访问受限资源时,系统不会提示用户授予“完整磁盘访问权限”。因此,用户可能不会意识到软件未完全运行。
基本上this solution不起作用(对于守护进程来说还不够)。
问题
为了解决这个问题,我想在安装过程中提示用户授予“完整磁盘访问权限”。我不知道如何实现。
是否可以在 pkg 安装过程中授予“完整磁盘访问权限”?如果是怎么办?
最佳答案
So when it accesses restricted resources user can't be prompted to grant "Full Disk Access"
没有应用程序可以提示授予“完整磁盘访问权限”。您可以提示访问其他特权“查找器和文件夹”位置(桌面、文档、下载等),但不提示访问全盘访问位置(邮件数据库等)
尽管它是一个守护进程,但您的守护进程应该能够提示访问“Finders and Folders”。
在 WWDC 2019 上专门讨论了授予对辅助应用程序的访问权限:
macOS 安全性进展 - WWDDC 2019
https://developer.apple.com/videos/play/wwdc2019/701/
时间戳 31:15
And while we're here, I'd like to talk about one of the enhancements that we've made in macOS Catalina to how apps are approved for Full Disk Access, while users can still manually add apps to the list using the plus button here.
One piece of feedback that we've gotten from developers is that it can be awkward for users to locate their app's privileged helpers.
So, now in macOS Catalina, executables that are denied access to files due to a lack of Full Disk Access approval are now pre-populated unchecked.
Here, we see one such helper identified by its executable name.
If that helper were embedded in a bundle, the display name in icon specifying the bundles Info.plist would be displayed instead.
这是 Apple 批准的请求全盘访问的方式。
关于MacOS:在安装过程中要求 "Full Disk Access",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60148608/