hpoul / file_picker_writable

Flutter plugin to choose files which can be read, referenced and written back at a later time.
https://pub.dev/packages/file_picker_writable
MIT License
17 stars 13 forks source link

Running on physical iphone, "The file couldn’t be opened because it doesn’t exist." #5

Open bradyt opened 4 years ago

bradyt commented 4 years ago

First of all, thank you so much for this plugin. I am very excited at the prospect of porting my app to iOS with the help of your plugin, as well as reducing effort of maintenance on Android. I did not trust my plugin code very much, and this plugin could potentially take all that off me.

At the time that I tested, I was on 1.1.1+1, but as I started to use my local clone of your project, I realize I should test again shortly with 1.1.1+2.

The plugin was working fine for me when I ran my app via Simulator.app, but when I try flutter run -d iphone on a physical device, I run into this error when I try to pick a fie.

flutter: PlatformException(ErrorProcessingResult, Error handling result url file:///private/var/mobile/Containers/Shared/AppGroup/8F03431C-961F-41F4-9296-BC5688DFD150/File%20Provider%20Storage/9850354/1lardL_81Lo4fmRBvjvOOlx-fKjSi4dKq/blah.test: Error Domain=NSCocoaErrorDomain Code=260 "The file couldn’t be opened because it doesn’t exist.", null)
flutter: #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:18)
<asynchronous suspension>
#2      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:329:12)
#3      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:356:48)
#4      FilePickerWritable.openFilePicker (package:file_picker_writable/src/file_picker_writable.dart:136:24)

Have you tried running the example/ app on a physical device? I briefly tried but ran into indirectly related issues.

My next strategy to debug this, when I can make time, is to increase logging, either using your method of logging, or as well by just inserting logging statements in the swift code, within the plugin. Please let me know if you have other ideas on how to isolate the issue.

I will also try again to see if I can test your example/ app, by perhaps overwriting my lib/ directory with the example/lib/, etc.

It's late here, so I'm sending this issue as is, otherwise it would be shorter.

hpoul commented 4 years ago

When exactly do you see this error? are you selecting a local file, or from iCloud, etc.? I'm not sure sure I understand, do you experience this error when using the example/ app, or your own app?

bradyt commented 4 years ago

Apologies for the hastily written issue.

I experience the error when using my own app. I meant that I had not figured out yet how to test your example app on a physical device. The error does not occur when I use a local drive (On My iPhone) on the simulator. The error occurred when I used Google Drive on a physical device. When I can make time again, it sounds like you would like me to test as identical a location as possible, between simulator and physical device. By the way, did you catch my question, asking if you had success running the example app on a physical iOS device? I will attempt to test that again soon. I had meant that my first attempt to use example app, I ran into unrelated issues, but I have some ideas how to get that "working".

amake commented 4 years ago

I am using this plugin successfully in my app on a physical device, with Google Drive.

However I have seen this exact error with Google Drive

PlatformException(ErrorProcessingResult, Error handling result url file:///private/var/mobile/Containers/Shared/AppGroup/8F03431C-961F-41F4-9296-BC5688DFD150/File%20Provider%20Storage/9850354/1lardL_81Lo4fmRBvjvOOlx-fKjSi4dKq/blah.test: Error Domain=NSCocoaErrorDomain Code=260 "The file couldn’t be opened because it doesn’t exist.", null)

For me, this seemed to be unrelated to my app or to this plugin. Rather it seemed to be iOS and/or Google Drive having some sort of freak out.

I tried a bunch of stuff (reinstall, reboot, etc.) but the only thing that worked was to locate the file in the iOS Files app and share it via AirDrop to my Mac. That seemed to force iOS to refresh its local data such that it could resolve things normally again.

hpoul commented 4 years ago

this sound weird.. But this only happens with Google Drive, not iCloud, etc.?

amake commented 4 years ago

I haven’t seen it with iCloud or any other provider, but I haven’t used anything as extensively as Google Drive.

amake commented 4 years ago

I had an incident with this problem yesterday that makes me think it has something to do with Google Drive’s account switching feature.

  1. Obtain a persistable identifier for a file in Google Drive
  2. In Google Drive, switch to a different Google account. The identifier is still valid but attempting to access it gets a “file not found” error.
  3. Switch back to the initial account in Google Drive. The identifier can once again be accessed.