Studyxnet / FilePicker-Plugin-for-Xamarin-and-Windows

FilePicker Plugin for Xamarin and Windows
MIT License
74 stars 52 forks source link

System.IO.DirectoryNotFoundException: Could not find a part of the path - Xamarin iOS #84

Closed jcus0006 closed 5 years ago

jcus0006 commented 5 years ago

This had been working for me but I am pretty positive that I have not touched anything which could have ruined the implementation of the file picker plugin!

I am using this code in the Shared project:

FileData fileData = await CrossFilePicker.Current.PickFile();

if (fileData == null)
    return; // user canceled file picking

    string fileName = fileData.FileName;

image

The values within the fileData object are as shown in the image.

fileData.DataArray is returning a System.IO.DirectoryNotFoundException - Could not find a part of the path...

The path of the file retrieved from iCloud looks like the below:

"file:///private/var/mobile/Containers/Data/Application/E4D562B3-0D10-4DEB-BAA2-742A69E034D9/tmp/com.atech.s2x.qm-Inbox/Mary.pdf\"

where com.atech.s2x.qm refers to the bundle identifier of the app.

The iCloud connector is properly configured. I am using the plugin version: 2.0.81-beta. Tried going back to the latest stable version but it gives me an error related to the plugin not being available in the portable version (or something of the sort).

Any help would be appreciated.


Update:

I downgraded to Beta version 2.0.64 (from 2.0.81) and it works properly on an iPhone 6s Plus (probably works on other iPhones) but nothing happens when attempting to browse on an iPad.

The method is accessed and this line is passed:

FileData fileData = await CrossFilePicker.Current.PickFile();

but the pop up prompt asking to choose a file from iCloud never comes up. Instead the process goes directly into the next line; fileData is null, and the method simply returns.

if (fileData == null)
    return;

So with version 2.0.81 I get the System.IO.DirectoryNotFoundException on both iPhone and iPad, whilst with version 2.0.64, it works on iPhone, but nothing happens on iPad.

jfversluis commented 5 years ago

Please have a look at: https://github.com/jfversluis/FilePicker-Plugin-for-Xamarin-and-Windows which is actually the package you are referring to. This repo is no longer maintained