我正在尝试在 Flutter 中构建一个自定义桌面应用程序,以便能够加载图片,例如图库。
为此,我将要求用户选择一个文件夹,它会自动显示图片。
现在,从简单的事情开始,由于这是第一次为 Mac 开发,我只是尝试通过Image.file(new File)
method.
The issue that I got back is
======== Exception caught by image resource service ================================================
The following FileSystemException was thrown resolving an image codec:
Cannot open file, path = 'media/preview.jpg' (OS Error: Operation not permitted, errno = 1)
我认为某种程度上与权利有关。
我的权利是:
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.assets.downloads.read-write</key>
<true/>
<key>com.apple.security.assets.pictures.read-write</key>
<true/>
<key>com.apple.security.assets.downloads.read-write</key>
<true/>
但由于我想要加载图片的文件夹可能在任何地方,我想知道这是否是我收到错误的原因。
我遇到了同样的问题并通过禁用来解决它com.apple.security.app-sandbox
in example/macos/Runner/DebugProfile.entitlements
:
<?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>
<false/>
</dict>
</plist>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)