Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] FilePicker.saveFile() Hangs Without Opening File Dialog #1640

Open
alexaungmyooo opened this issue Dec 3, 2024 · 1 comment
Open
Labels
new issue An issue that hasn't yet been seen from the maintainer stale

Comments

@alexaungmyooo
Copy link

alexaungmyooo commented Dec 3, 2024

Describe the bug
The FilePicker.platform.saveFile() method hangs indefinitely on iOS and does not open the file save dialog. The issue occurs with the latest version of the file_picker plugin (8.1.4) even in the provided example app.

This happens consistently on both physical devices and simulators, with no meaningful error messages or logs indicating the cause.

Platform

  • [ ] Android
  • [✓] iOS
  • [ ] Web
  • [ ] Desktop

Platform OS version
iOS 18.0.1 (22A3370) (Observed on both simulator and physical devices)
Model: iPhone 15 Plus

How are you picking?

try {
  final result = await FilePicker.platform.saveFile(
    dialogTitle: 'Save Backup File',
    fileName: 'test_backup.zip',
  );

  if (result == null) {
    print('User canceled the picker.');
  } else {
    print('File saved at: $result');
  }
} catch (e) {
  print('Error: $e');
}

Details to reproduce the issue

- Clone the official file_picker GitHub repository and navigate to the example app.
- Run the example app on an iOS device or simulator.
- Tap the "Save File" button.
- Observe that the app hangs indefinitely, and no file dialog appears.

Error Log
No Flutter-side errors are reported, but the app hangs when FilePicker.platform.saveFile() is invoked.

But we got this error in xcode

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull data]: unrecognized selector sent to instance 0x1f67ef748'
*** First throw call stack:
(0x19187108c 0x18eb732e4 0x1919777c8 0x19180e888 0x19180e1b0 0x104fb5e14 0x104fb5aac 0x1084dacc4 0x107f5cd88 0x104aa8a30 0x104aaa71c 0x104abade8 0x104aba9a4 0x191843f64 0x191841188 0x1918405b8 0x1dd2d61c4 0x1943962c0 0x194444ddc 0x104e64124 0x1b7014d34)
libc++abi: terminating due to uncaught exception of type NSException

Screenshots and/or video
Not applicable since the dialog does not appear.

Flutter Version details

[✓] Flutter (Channel stable, 3.24.5, on macOS 15.1.1 24B91 darwin-x64, locale en-GB)
    • Flutter version 3.24.5 on channel stable at /Users/aungmyooo/Development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision dec2ee5c1f (3 weeks ago), 2024-11-13 11:13:06 -0800
    • Engine revision a18df97ca5
    • Dart version 3.5.4
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/aungmyooo/Library/Android/sdk
    • Platform android-35, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16B40
    • CocoaPods version 1.16.2

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

[✓] Android Studio (version 2024.1)
    • 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 17.0.11+0-17.0.11b1207.24-11852314)

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

[✓] Connected device (3 available)
    • Aung Myo’s iPhone (mobile) • 00008120-0006612E0198A01E • ios            • iOS 18.0.1 22A3370
    • macOS (desktop)            • macos                     • darwin-x64     • macOS 15.1.1 24B91 darwin-x64
    • Chrome (web)               • chrome                    • web-javascript • Google Chrome 131.0.6778.86

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Additional context
The Info.plist includes all required keys:

<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>UIFileSharingEnabled</key>
<true/>
<key>UISupportsDocumentBrowser</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notification</string>
</array>

The Podfile configuration:

platform :ios, '13.0'

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
@alexaungmyooo alexaungmyooo added the new issue An issue that hasn't yet been seen from the maintainer label Dec 3, 2024
Copy link

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

@github-actions github-actions bot added the stale label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new issue An issue that hasn't yet been seen from the maintainer stale
Projects
None yet
Development

No branches or pull requests

1 participant