我的圈套
使用macOS沙箱,我启用了对
都具有读/写权限。
但是,当我使用正式的file_selector
和path_provider
时。我仍然不能引用下载/音乐/电影/图片之外的任何文件和文件夹。
我总能得到
OS Error: Operation not permitted, errno = 1
每当我试图访问上述目录之外的目录时。
期望值
我希望通过授予User selected file
权限,我应该能够允许file_selector访问比如说用户文档/桌面文件夹。否则,如果用户需要那些预定义文件夹的单独权限,它怎么可能有“选定的”文件?
我从本机开发人员的文章中看到,需要调用本机函数NSOpenPanel
。
有人能告诉我怎么做吗?是颤振不支持这种用户选择的文件功能吗?
我应该求助于平台方法频道吗?这听起来有点疯狂。
发布于 2021-06-25 02:33:01
我是根据其他答案自己解决的。要旨
Downloads/Movies/Music/Pictures
。例如,您将无法通过使用path.join(path_provider.getApplicationDocumentsDirectory(), '..');
这只会让你
OS Error: Operation not permitted, errno = 1
- Within Xcode project `Signing & Capabilities` panel, click the "X" button at the right end of the `App Sandbox` category.
- Editing the plist files `DebugProfile.entitlements` and `Release.entitlements` by setting the field
<key>com.apple.security.app-sandbox</key>
<false/>
在此之后,file_selector
API将能够访问应用程序沙箱之外的文件。
https://stackoverflow.com/questions/68114273
复制相似问题