capacitor-plugins icon indicating copy to clipboard operation
capacitor-plugins copied to clipboard

bug: File picker not working on iOS if types (mime) option is defined

Open aless673 opened this issue 8 months ago • 7 comments

Plugin(s)

  • [ ] Android Battery Optimization
  • [ ] Android Dark Mode Support
  • [ ] Android Edge-to-Edge Support
  • [ ] Android Foreground Service
  • [ ] App Review
  • [ ] App Shortcuts
  • [ ] App Update
  • [ ] Asset Manager
  • [ ] Audio Recorder
  • [ ] Background Task
  • [ ] Badge
  • [ ] Bluetooth Low Energy
  • [ ] Cloudinary
  • [ ] Contacts
  • [ ] Datetime Picker
  • [ ] File Compressor
  • [ ] File Opener
  • [x] File Picker
  • [ ] Live Update
  • [ ] Managed Configurations
  • [ ] NFC
  • [ ] Photo Editor
  • [ ] Posthog
  • [ ] Printer
  • [ ] Screen Orientation
  • [ ] Screenshot
  • [ ] Speech Recognition
  • [ ] Speech Synthesis
  • [ ] Torch
  • [ ] Zip

Version

7.0.1

Platform(s)

  • [ ] Android
  • [x] iOS
  • [ ] Web

Current behavior

On iOS devices, the pickFiles doesn't work and doesn't show any error when you use the option PickFilesOptions::types

NB: it works correctly on developement IPA, but not in production one

Expected behavior

PickFilesOptions::types option should not block the process of picking up files

Reproduction

https://github.com/aless673/cap-file-picker-ios-bug

Steps to reproduce

  1. build production IPA with this repo : https://github.com/aless673/cap-file-picker-ios-bug
  2. try on real device

Other information

No response

Capacitor doctor

💊   Capacitor Doctor  💊

Latest Dependencies:

  @capacitor/cli: 7.2.0
  @capacitor/core: 7.2.0
  @capacitor/android: 7.2.0
  @capacitor/ios: 7.2.0

Installed Dependencies:

  @capacitor/cli: 7.2.0
  @capacitor/core: 7.2.0
  @capacitor/android: 7.2.0
  @capacitor/ios: 7.2.0

[success] Android looking great! 👌
[error] Xcode is not installed

Before submitting

  • [x] I have read and followed the bug report guidelines.
  • [x] I have attached links to possibly related issues and discussions.
  • [x] I understand that incomplete issues (e.g. without reproduction) are closed.

aless673 avatar Apr 24 '25 18:04 aless673

This issue has been labeled as needs: reproduction. This label is added to issues that need a code reproduction.

Please provide a Minimal, Reproducible Example using this template in a public GitHub repository so we can debug the issue.

If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for us to reproduce the issue.

github-actions[bot] avatar Apr 24 '25 18:04 github-actions[bot]

@robingenz reproduction added

aless673 avatar Apr 24 '25 19:04 aless673

@robingenz reproduction is done since 1 month, can we change the labels ?

aless673 avatar May 28 '25 15:05 aless673

Hey there, any updates on this ? I'm having this issue aswell using pickFiles with types option on iOS (opens documents but can't select any file) N.B. works fine on android and web

const result = await FilePicker.pickFiles({
       types: ['image/*', 'video/*'],
    });

eloipeloux avatar Jul 30 '25 07:07 eloipeloux

Hey there, any updates on this ? I'm having this issue aswell using pickFiles with types option on iOS (opens documents but can't select any file) N.B. works fine on android and web

const result = await FilePicker.pickFiles({
       types: ['image/*', 'video/*'],
    });

I would recommend you to not restrict types, but to filter post-selection. That's obviously a temporary fix

aless673 avatar Jul 30 '25 08:07 aless673

That's what I ended up doing ye, thanks tho ! Hope this will be fixed soon

eloipeloux avatar Jul 30 '25 08:07 eloipeloux

We haven't had time to look into it yet. However, PRs are welcome.

robingenz avatar Jul 30 '25 09:07 robingenz