Flutter:file_picker_error,无法创建临时文件

Mau*_*ini 13 macos ios flutter

我在 Mac M1 上的 flutter 代码中收到此错误:

[MethodChannelFilePicker] 平台异常:PlatformException(file_picker_error,无法创建临时文件,错误域= NSItemProviderErrorDomain代码= -1000“无法加载类型public.item的表示” UserInfo = {NSLocalizedDescription =无法加载类型public.item}的表示, null)[VERBOSE-2:ui_dart_state.cc(209)]未处理的异常:PlatformException(file_picker_error,无法创建临时文件,错误域= NSItemProviderErrorDomain代码= -1000“无法加载类型public.item的表示” UserInfo = {NSLocalizedDescription =无法加载类型public.item的表示},null)

final result = await FilePicker.platform.pickFiles(
    allowMultiple: false,
    type: FileType.image,
);
Run Code Online (Sandbox Code Playgroud)

我还在 info.plist 中插入了这段代码:

<key>UIBackgroundModes</key>
<array>
    <string>fetch</string>
    <string>remote-notification</string>
</array>
<key>NSAppleMusicUsageDescription</key>
<string>Explain why your app uses music</string>
<key>UISupportsDocumentBrowser</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
Run Code Online (Sandbox Code Playgroud)

有什么建议么?

Gou*_*har 23

您可能正在尝试在模拟器 \xe2\x80\x94 上使用粉红色花朵的照片,这是自 iOS 14 以来已知的 iOS 模拟器问题。请忽略它或在真实设备上测试它。

\n

  • 不过,我在模拟器中的所有照片上都遇到了错误。我使用 mac mini m1 和 ios 15 模拟器。我认为大多数出现此错误的人通常使用与我相同的设备和模拟器。 (2认同)