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 app crashes on picking many videos - iPhone 5s #606

Closed
ron3001 opened this issue Feb 5, 2021 · 6 comments
Closed

iOS app crashes on picking many videos - iPhone 5s #606

ron3001 opened this issue Feb 5, 2021 · 6 comments
Labels
bug Something isn't working fixed Issue has been addressed and already been deployed or waiting to deploy on master.

Comments

@ron3001
Copy link

ron3001 commented Feb 5, 2021

Describe the bug
iOS app crashes on picking many videos. (iPhone 5s only)
Platform
iOS
Platform OS version
iOS 12.5.1
How are you picking?

FilePickerResult paths;
    try {
      paths = await FilePicker.platform.pickFiles(
        type: isMedias ? FileType.media : FileType.any,
        allowMultiple: true,
        withData: false,
      );
    } on PlatformException catch (e) {
      print("Unsupported operation" + e.toString());
      throw Exception();
    } catch (ex) {
      print(ex);
      throw Exception();
    }

Details to reproduce the issue
Attempt to pick files from type media. When Photos opens, choose some videos - total size around 150mb. When the videos are selected, after you choose Select, a spinner shows and spins for around 3 minutes, then the app crashes. Available storage on the device is ~1GB. The spinner shows every time for around 3 minutes, but the crash sometimes does not occur.
Flutter Version details
[✓] Flutter (Channel stable, 1.22.0, on Mac OS X 10.15.7 19H114)
• Flutter version 1.22.0
• Dart version 2.10.0

@miguelpruivo
Copy link
Owner

Hi. Try checking the crash log by running it directly with Xcode.

@ron3001
Copy link
Author

ron3001 commented Feb 5, 2021

Hi. I run it directly with Xcode.
The error is in FilePickerPlugin.m - line 266 - [paths addObject:asset.localTemporaryPath.absoluteURL];
The exception message is "*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil"

@miguelpruivo
Copy link
Owner

@ron3001 looks that for some reason the file couldn't be cached, hence the NPE. Try freeing a bit more space on the device or pick other files and see if it still happens.

@ron3001
Copy link
Author

ron3001 commented Feb 5, 2021

I freed some more space and the issue appears to be gone! Is there some way to catch this specific case?

@miguelpruivo
Copy link
Owner

@ron3001 yes. Actually if I add an error handling for this on native code it might catch the error and throw it to Flutter so you can actually catch it.

I’ll see what I can do.

@miguelpruivo miguelpruivo added the bug Something isn't working label Feb 19, 2021
@miguelpruivo miguelpruivo added the fixed Issue has been addressed and already been deployed or waiting to deploy on master. label Mar 3, 2021
@miguelpruivo
Copy link
Owner

Fixed with 2.1.7. From now on, the crash shouldn't happen since null check was added there.

Thank you for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed Issue has been addressed and already been deployed or waiting to deploy on master.
Projects
None yet
Development

No branches or pull requests

2 participants