Closed metal450 closed 10 months ago
Looking at https://github.com/AvaloniaUI/Avalonia.Essentials you probably will have more luck with .NET MAUI Essentials rather than Xamarin.Essentials. Good luck!
I'm already using it all over my app in the Android portion. Is there some reason why this doesn't work on iOS? That answer really has no info at all about what the issue is...it just says "use something else"...
@metal450 you're trying to use a product that targets Xamarin on a completely different framework that we don't support with Essentials. Additionally, this project is also set to retire in a few month.
I'm pointing out other options for you to explore where people have been successful with making this work with Avalonia and I hope that will help you. Sorry if that wasn't clear from my message.
Additionally, this project is also set to retire in a few month.
Ah, I see. Would probably good to have a prominent note about that, would it not? So new users starting out with new projects know that support is about to be dropped & we should probably start out with alternatives instead...
Description
I'm successfully using Xamarin.Essentials in the Android project of a cross-platform Avalonia app.
From the iOS project, if I try to use
FileSystem.CacheDirectory
, I getXamarin.Essentials.NotImplementedInReferenceAssemblyException: 'This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.
I'm definitely referencing Xamarin.Essentials from all 3 projects (the iOS project, the Android project, and the "common" project). I'm assuming the inability to use
FileSystem.CacheDirectory
is because I haven't initialized Xamarin by callingXamarin.Essentials.Platform.Init()
, per the Getting Started guide - however, I can't, as I get "The type or namespace 'Platform' does not exist in the namespace 'Xamarin.Essentials'.I've seen other issue reports with a similar error message (i.e. https://github.com/xamarin/Essentials/issues/1964), however they relate to Android, not to iOS.
Steps to Reproduce
Basic Information