How to get Launcher to work properly on MacOS in MAUI?

John Oehler 0 Reputation points

I have a .net maui app that I am trying to get running on MacOS (Catalyst).

When using the example provided in the documentation a "share" dialog open up instead of the PDF file and the default viewer.

share menu image

It does the same thing when using the exact code from the docs:

string popoverTitle = "Read text file";
string name = "File.txt";
string file = System.IO.Path.Combine(FileSystem.CacheDirectory, name);

System.IO.File.WriteAllText(file, "Hello World");

await Launcher.Default.OpenAsync(new OpenFileRequest(popoverTitle, new ReadOnlyFile(file)));

I associated pdf files with Chrome, and they display fine when launced from Finder.

Any help or work-arounds would be greatly appreciated!

A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,156 questions
{count} votes