Tiz*_*ica 8 flutter flutter-desktop
我正在尝试在 Flutter 中构建一个自定义桌面应用程序,以便能够加载图片,例如图库。为此,我将要求用户选择一个文件夹,它会自动显示图片。
现在,从简单的事情开始,由于这是第一次为Mac开发,我只是尝试通过方法显示图片Image.file(new File)。
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)
Run Code Online (Sandbox Code Playgroud)
我认为某种程度上与权利有关。我的权利是:
<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/>
Run Code Online (Sandbox Code Playgroud)
但由于我想要加载图片的文件夹可能在任何地方,我想知道这是否是我收到错误的原因。
yus*_*ulx 13
我遇到了同样的问题并通过禁用来解决com.apple.security.app-sandbox它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>
Run Code Online (Sandbox Code Playgroud)
因此,只要您的应用程序位于沙箱中,如果用户从打开的对话框中选择这些文件夹(下载、图片、音乐和电影)之外的文件,它看起来就只能打开它们。
因此,出于开发目的,我禁用了沙箱,并意识到我无法在 Apple Store 上分发。
但至少我可以发展。享受
| 归档时间: |
|
| 查看次数: |
4876 次 |
| 最近记录: |