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

John Oehler 0 Reputation points
2023-04-28T16:30:49.21+00:00

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!

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,377 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.