Essentials icon indicating copy to clipboard operation
Essentials copied to clipboard

[Bug] Launcher Feature does not open file correctly on IOS.

Open snufffgit opened this issue 3 years ago • 3 comments

Description

Launcher Feature does not open file correctly on IOS.

Scenario 1:

I can reproduce this error in your sample application.

await Launcher.OpenAsync(new OpenFileRequest { File = new ReadOnlyFile(file), PresentationSourceBounds = rect });

Scenario 2:

await Launcher.OpenAsync(new OpenFileRequest { File = new ReadOnlyFile(FullPath, System.Net.Mime.MediaTypeNames.Application.Pdf) });

Steps to Reproduce

Scenario 1:

  1. Open Xamarin.Essentials sample application.
  2. Go to Launcher sample
  3. Type some text on File Contents
  4. Click on Open File button.

Scenario 2:

  1. Get a pdf path.
  2. Execute Scenario 2 code: Launcher.OpenAsync with ReadOnlyFile(FullPath, System.Net.Mime.MediaTypeNames.Application.Pdf) overload.

Expected Behavior

Scenario 2:

image

Actual Behavior

Scenario 1:

Application throws an unhandled exception as follows: System.ArgumentNullException has been thrown Value cannot be null. Parameter name:uti

Scenario 2:

image

Basic Information

  • Version with issue:
  • Last known good version:
  • IDE: Visual Studio 2022 Mac
  • Platform Target Frameworks:
    • iOS: 15.5
    • Android: Android 12.0 - S API Level 31
    • UWP: N/A
  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices:

snufffgit avatar Jul 14 '22 11:07 snufffgit

This seems related to https://github.com/xamarin/Essentials/issues/1877. Please check if the workaround I found https://github.com/xamarin/Essentials/issues/1877#issuecomment-1206154979 works for you.

tilemmpon avatar Aug 05 '22 09:08 tilemmpon

This seems related to #1877. Please check if the workaround I found #1877 (comment) works for you.

That was the 2 Scenario, even when using second parameter, the behaviour should be open the document, not the edit actions middle screen .

snufffgit avatar Aug 05 '22 10:08 snufffgit

Indeed I understand. Xamarin is in security support since MAUI is out now so I assume these bugs will not be addressed anymore. I would suggest to either move to MAUI or if not possible use a workaround (for example I open PDFs in iOS via the browser).

tilemmpon avatar Nov 07 '22 08:11 tilemmpon