iosfluttermacos

Flutter: file_picker_error, Temporary file could not be created


I am getting this error, in flutter code, on Mac M1:

[MethodChannelFilePicker] Platform exception: PlatformException(file_picker_error, Temporary file could not be created, Error Domain=NSItemProviderErrorDomain Code=-1000 "Cannot load representation of type public.item" UserInfo={NSLocalizedDescription=Cannot load representation of type public.item}, null) [VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: PlatformException(file_picker_error, Temporary file could not be created, Error Domain=NSItemProviderErrorDomain Code=-1000 "Cannot load representation of type public.item" UserInfo={NSLocalizedDescription=Cannot load representation of type public.item}, null)

final result = await FilePicker.platform.pickFiles(
    allowMultiple: false,
    type: FileType.image,
);

I also inserted this code in 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/>

any suggestions?


Solution

  • You are probably trying with the photo of the pink flowers on the simulator — that's a known iOS simulator issue since iOS 14. Please ignore it or test it on a real device.