miguelpruivo / flutter_file_picker

File picker plugin for Flutter, compatible with mobile (iOS & Android), Web, Desktop (Mac, Linux, Windows) platforms with Flutter Go support.
MIT License
1.34k stars 673 forks source link

iOS Simulator can't pick .zip files #1148

Closed stephanie-finch closed 1 year ago

stephanie-finch commented 2 years ago

Describe the bug File picking doesn't appear to work on iOS 16 Simulator, although it appears to work in production for iOS 16. Simulator shows grayed out files. Android emulator can load .zip file.

We've tried with both file_picker v5.2.0+1 and file_picker v5.2.1.

Platform

Platform OS version iOS 16

How are you picking?

final FilePickerResult? result =
   await FilePicker.platform.pickFiles(
   type: FileType.custom,
   allowedExtensions: ['zip'],
);

Details to reproduce the issue Try to pick .zip files from iOS 16 simulator. All .zip files are grayed out.

Error Log No specific error gets logged.

Screenshots and/or video

image image

Flutter Version details

[✓] Flutter (Channel stable, 3.0.1, on macOS 12.5.1 21G83 darwin-arm, locale
    en-US)
    • Flutter version 3.0.1 at /Users/stephanie/Dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision fb57da5f94 (5 months ago), 2022-05-19 15:50:29 -0700
    • Engine revision caaafc5604
    • Dart version 2.17.1
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/stephanie/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • ANDROID_SDK_ROOT = /Users/stephanie/Library/Android/sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.72.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.50.0

[✓] Connected device (3 available)
    • iPhone SE (3rd generation) (mobile) • 778DC228-3C3A-4283-8696-222CB486AFA5
      • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-0 (simulator)
    • macOS (desktop)                     • macos
      • darwin-arm64   • macOS 12.5.1 21G83 darwin-arm
    • Chrome (web)                        • chrome
      • web-javascript • Google Chrome 106.0.5249.103

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Additional context n/a

stefangaller commented 2 years ago

I have a similar problem with Android and csv files. They are greyed out although I selected them like

final result = await FilePicker.platform.pickFiles(
  type: FileType.custom,
  allowMultiple: false,
  allowedExtensions: ['csv'],
);
github-actions[bot] commented 2 years ago

This issue is stale because it has been open for 14 days with no activity.

ralfeus commented 2 years ago

Have same issue:

final file = await FilePicker.platform.pickFiles(allowMultiple: false, withData: true);
github-actions[bot] commented 2 years ago

This issue is stale because it has been open for 14 days with no activity.

willyfromtheblock commented 1 year ago
  FilePickerResult? result =
                              await FilePicker.platform.pickFiles(
                                   type: FileType.custom,
                                   allowedExtensions: [
                                     'csv'
                                   ],                                  );

Also does grey out on android 10. No selection possible.

okerivy commented 1 year ago
FilePickerResult? result = await FilePicker.platform.pickFiles(
      type: FileType.custom,
      allowMultiple: true,
      allowedExtensions: ['gcode'],
    );

filter gcode files, also does grey out on iOS 15. No selection possible.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 14 days with no activity.

ralfeus commented 1 year ago

The issue is still actual

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 14 days with no activity.

ralfeus commented 1 year ago

The issue is still actual

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 14 days with no activity.

ralfeus commented 1 year ago

Still actual

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 14 days with no activity.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 14 days since being marked as stale.

willyfromtheblock commented 1 year ago

this issue is not fixed, is it?

ralfeus commented 1 year ago

It's not. Seems the maintainer has other priorities

Chralu commented 1 year ago

Hi,

the issue comes from iOS file management.

To get it working with non-natively handled file types, you must declare an uniform type identifier.

Quick example : accepting OPML files

Add these in your Info.plist file :

        <key>UTExportedTypeDeclarations</key>
        <array>
            <dict>
                <key>UTTypeIdentifier</key>
                <string>podcast.opml</string>
                <key>UTTypeConformsTo</key>
                <array>
                    <string>public.xml</string>
                </array>
                <key>UTTypeDescription</key>
                <string>OPML ( Outline Processor Markup Language) is an XML format for outlines.</string>
                <key>UTTypeTagSpecification</key>
                <dict>
                    <key>public.filename-extension</key>
                    <array>
                        <string>opml</string>
                    </array>
                </dict>
            </dict>
        </array>
  1. UTTypeIdentifier value will be the value you use in your Flutter core. It seems that the value MUST follow the reverse-DNS format (a single segment value like opml doesn't work).
  2. public.filename-extension are file extension matching this filetype.
anhtuan23 commented 1 year ago

The solution by @Chralu works. I think this should be added to the package's documentation.

philenius commented 1 year ago

@anhtuan23 and @Chralu, thank you, I documented it here https://github.com/miguelpruivo/flutter_file_picker/wiki/Troubleshooting#-issue-9