Can't seem to use Xamarin.Essentials in net6.0-ios project

Sam 21 Reputation points
2022-09-09T23:31:42.903+00:00

I can't seem to use Xamarin.Essentials in my net6.0-ios project. I'm only attempting to use Share (share a link) and Browser (open a link), but both fire "Not implemented ... pleast install NuGet package" errors. I have Xamarain.Essentials v1.7.3 installed via NuGet in this project, as well as a net6.0-android project where everything works without issue. I have disabled Linker.

I was able to get Share to work by cobbling together portions of Xamarin.Essentials.Share directly into the project, but this is obviously a very undesirable solution. I couldn't get Browser (OpenAsync) to work at all, even using this method.

Maybe I'm just missing some directive or something in my .csproj to tell Xamarin.Essentials that this is for ios? The project compiles and runs fine, but as soon as it tries to do anything platform-specific it crashes with the "Not implemented in this portable assembly" error, as if the ios-specific code just isn't compiled in my Xamarin.Essentials reference.

Using Visual Studio 2022 on Windows 10.

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

Accepted answer
  1. r2 76 Reputation points
    2022-09-11T07:13:37.907+00:00

    (Most) essentials features are baked into Maui now, and you should be able to access them if you have <UseMaui> in your csproj.
    If you're doing 'native', then this include might work: https://techcommunity.microsoft.com/t5/app-development/can-we-use-maui-essentials-without-maui-ui-framework/m-p/3276024

    Mostly they come under the Microsoft.Maui.* namespace, for example:
    Microsoft.Maui.ApplicationModel.DataTransfer.Share.Default.RequestAsync("share");


0 additional answers

Sort by: Most helpful

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.