Open vg12345 opened 3 years ago
I tested your sample. It works perfectly. Could you provide more information? I also added a display of the resulting file to your sample: App6.zip
The problem is that picker (browsing) window is not closing automatically when I tap on the file. I just tap on the file and nothing happens. I use real device (iPhone 7 with iOS 14.4) and try to pick file from "On My iPhone" location. BTW, if I use the deprecated NuGet package Xamarin.Plugin.FilePicker, it works perfectly.
@vg12345 Do you have this issue only with iPhone 7 (iOS 14.4)?
This is the only iOS device I work with
I tried to pick TXT, PNG and ZIP files
@vg12345 I tested this on a real iphone and simulator and everything works correctly.
Perhaps your problem is related to this one? https://github.com/xamarin/Essentials/issues/1587 https://github.com/xamarin/Essentials/issues/1612
I'm not sure. I have Mono interpreter enabled. The picker still does not work on iPhone that is disconnected from PC after deploy.
I would really like to help you, this feature is very important to me too. But I can't reproduce this bug.
Hi,
Finally, I debugged Essentials FilePicker code on my device. The problem is in the following row that does not work for me (FilePicker.ios.cs, line 27):
using var documentPicker = new UIDocumentPickerViewController(allowedUtis, UIDocumentPickerMode.Open);
If I change the Open flag to Import, then everything works as expected:
using var documentPicker = new UIDocumentPickerViewController(allowedUtis, UIDocumentPickerMode.Import);
All constructors using UIDocumentPickerMode are obsolete as of IOS 14.0
@dimonovdd should we change the picker mode in the short term?
should we change the picker mode in the short term?
That's a good question. I use the FilePicker in several of my apps. I haven't any problems with it on iOS. Perhaps the import mode will be more flexible, but how will it work with large files?
The other question is: Is this issue only with Hot Restart? Does it work fine without it? May just be a limitation.
Perhaps your problem is related to this one?
1587
1612
@vg12345 said his problem is not related to #1587
May be it’s better to add the open mode as an optional parameter, so the developers will be allowed to decide themselves in which mode the want to open it?
Add a gitignore file to your root directly and then sync it with github.
Add a gitignore file to your root directly and then sync it with github.
@jamesmontemagno you must have mixed up the issue. #1723
I have the same problem on all physical iOS devices. ⚠️ But on Android, everything works fine. Are there any solutions?
You can use the code from Plugin.FilePicker for iOS – it works fine. It is relatively small effort to integrate it in your app.
GitHub - jfversluis/FilePicker-Plugin-for-Xamarin-and-Windows: FilePicker Plugin for Xamarin and Windowshttps://github.com/jfversluis/FilePicker-Plugin-for-Xamarin-and-Windows
It is crazy that after all this time, this is still an issue. Also look at my branch: https://github.com/EvoPulseGaming/FilePicker-Plugin-for-Xamarin-and-Windows I use this for android/ios/uwp. I have not looked at anything added to xamarin in over a year so they probably have most of this, but this may help you figure something out.
Not working for me either !!
I even tried the "AppEssentials" demo app and even that doesn't work for me. This is on an iPhone 8 (iOS 14.7.1)
I tried recording the app but you can't see any of the touch gestures so it's a bit pointless.
Same issue for me...
Same issue for me using iPhone 12 pro. The only way to return from the picker is to cancel, which returns a null.
In my case I am exporting a .txt file to a local folder with Share.RequestAsync and then turning around and trying to import it with FilePicker.PickAsync(). What could be simpler?
The problem is evidently on the Windows side only. I just tried the same project on VSMac and the picker selected the file successfully. To be clear, the problem is happening when I am debugging from my Windows machine running VS 2022 and the iPhone directly attached via USB.
So I just started testing on an iPad Pro and I immediately hooked it up to my Windows laptop because it is so much easier to provision with the Wildcard on the VS Windows side. In testing the Share.RequestAsync I only wasted a couple of hours this time before running across my post from a couple of months ago! Yes, the bug still exists on the VS Windows side but the Share.RequestAsync works fine on the VS Mac side.
it still happens, it's weird because sometimes it works fine, other times it disables, I tried on VS Mac and doesn't work
I have recently integrated the FilePicker into one of my apps and it is working fine when built and deployed via testflight.
I don't believe the picker works on simulators and also could have sandbox issues via hot restart as well. Best approach is to test via testflight or plug in a device into your mac for full testing.
@jamesmontemagno Did you build the app using a Mac? If so, try it through a Windows computer and without Testflight.
I am asking this because I have heard from some that this error does not appear when building directly on a Mac.
@jamesmontemagno Did you build the app using a Mac? If so, try it through a Windows computer and without Testflight.
I am asking this because I have heard from some that this error does not appear when building directly on a Mac.
I build the app using a Mac, with settings M1 Chip , MacOs BigSur 11.6.5, Visual Studio Mac 2019 Enterprise (8.10.20), Xamarin.IOs 15.6.0.3 with the last version of XF (5.0.0.2401), and Essentials (1.7.1) and doesn't work
I used a Console.WriteLine() to show exceptions and the log show me:
(DocumentManager)[2597]
this appear after clicking on the file to select it.
Are you running it on an emulator or a physical device? It only works for me on a physical device.
This is my direct code:
async Task Import()
{
try
{
var options = new PickOptions
{
PickerTitle = "Please My Cadence Data File",
};
var result = await FilePicker.PickAsync(options);
if (result == null)
return;
if(!result.FileName.EndsWith("txt", StringComparison.OrdinalIgnoreCase) || !result.FileName.StartsWith("mycadence"))
{
await Application.Current.MainPage.DisplayAlert("Invalid file", "Please select the data file that starts with 'mycadence' and has an extension of '.txt'.", "OK");
return;
}
IsBusy = true;
var json = File.ReadAllText(result.FullPath);
var data = JsonConvert.DeserializeObject<ImportExportFile>(json);
if(data?.Version != "1")
{
await Application.Current.MainPage.DisplayAlert("Invalid data", "This version of My Cadence data is not supported on this version of the app.", "OK");
return;
}
if ((data?.Rides?.Count ?? 0) <= 0)
{
await Application.Current.MainPage.DisplayAlert("Invalid data", "No rides were found in the selected data.", "OK");
return;
}
/*var choices = new[] { "Merge with existing data", "Override existing data" };
var import = await Application.Current.MainPage.DisplayActionSheet($"Located {data.Rides.Count} rides, how would you like to import the data?", "Cancel", null, choices);
if (import == "Cancel")
return;*/
var confirm = await Application.Current.MainPage.DisplayAlert("Confirm import", $"Located {data.Rides.Count} rides, are you sure you want to import these rides? They will be merged into existing data.", "Import data", "Cancel");
if (!confirm)
return;
RideHistoryPage.ImportedData = true;
//will add all in
var addedCount = await database.AddAllCheckForDuplicates(data.Rides);
await Application.Current.MainPage.DisplayAlert("Import complete", $"{addedCount} unique new rides have been merged into your existing data.", "OK");
}
catch (Exception ex)
{
await Application.Current.MainPage.DisplayAlert("Unable to import data", $"The following error occured, please email support: {ex}", "OK");
}
finally
{
IsBusy = false;
}
}
Greetings to all,
I have identified the error, it seems to be due to the provisioning profiles.
Indeed, in the simulator this stopped working, but I also had this error in physical devices, using kobiton and applivery to load the app, they did not allow selecting files, as well as using a physical device, what I did was use automatic provisioning by linking my account from apple and using the VS WildCard Development profile and the selector is no longer frozen when I click on the document to select.
@jamesmontemagno Is it something we should worry about? since I have always used manual provisioning and it had not failed...
It should be clarified that the provisioning profiles and certificates are not expired
It's been almost a year and a half, and something as simple as opening a file is still not working. Incredible.
[Edit] Seems to only be an issue with Hot Restart. When compiling using an actual mac, the dialog works correctly.
It's been 2 years man, At least do something about it!!!!!!! @jfversluis Bro your old package works with this https://github.com/jfversluis/FilePicker-Plugin-for-Xamarin-and-Windows can you please unarchive it at least this is Frustrating to another degree!!!!!!!
It's been 2 years man, At least do something about it!!!!!!! @jfversluis Bro your old package works with this https://github.com/jfversluis/FilePicker-Plugin-for-Xamarin-and-Windows can you please unarchive it at least this is Frustrating to another degree!!!!!!!
Tried Uno.Platform last week and I feel comfortable now. Their file pickers works smoothly even in WebAssembly!
Yes, my app runs just in the browser with the awesome WinUI design which is invented by Microsoft but not fully compatible by Microsoft.MAUI!
I am having an issue where the Picker shows up but no file can be selected (all files are grayed out). Is it the same issue?
UPDATE: apparently it's an iOS simulator bug. I tried writing platform specific code and the same problem happens. No problem running on real device though.
Reproduced on iOS v14.4 Xamarin.Essentials v1.6.1 Xamarin.Forms v5.0.0.2012
Code example:
private async void OnPickButtonClicked(object sender, EventArgs e) { var file = await FilePicker.PickAsync(); }
Attached is the sample project App6.zip