AvaloniaUI / AvaloniaMauiHybrid

Brings templated controls, pixel perfect rendering, animations, styling and composition to Maui
MIT License
175 stars 13 forks source link

Maui embedding to Avalonia is not working with iOS #17

Closed z-eh closed 7 months ago

z-eh commented 7 months ago

I use the following versions: .NET 8 Avalonia.iOS: 11.0.9 Avalonia.Maui: 11.0.9 Microsoft.Maui.Controls: 8.0.7 Microsoft.Maui.Essentials: 8.0.7

Steps to reproduce: Follow the guide in the README.md When you reach the point when you need to use the UseMaui() extension method you can see, that not selecting the required extension method for iOS which requires the AppDelegate instance, instead it uses the simple UseMaui method with the AppBuilder.

z-eh commented 7 months ago

image

maxkatz6 commented 7 months ago

Do you have using Avalonia.Maui; in your file? This code should be enough, and you can try it in our samples.

z-eh commented 7 months ago

Yes I have, that's not the issue. The issue is, that in the following part of the code: image As you can see somehow the system selects the last one instead of the iOS part.

z-eh commented 7 months ago

I made a repo which can help to reproduce the issue: https://github.com/z-eh/avalonia-maui-bug-repro

maxkatz6 commented 7 months ago

I can build your repro with no issues image

maxkatz6 commented 7 months ago

@z-eh can you try to run "dotnet build" on your solution? And if there is an error - send it here. Possibly you are missing .NET workloads.

As you can see somehow the system selects the last one instead of the iOS part.

It's just an IDE showing the least specific option. During the build, for "net8.0-ios" project "#if IOS" branch should be selected.

z-eh commented 7 months ago

Hi, my workloads are fine, but something is not okay. image Workloads: image

z-eh commented 7 months ago

I got the root cause of the issue. My .NET 8 SDK was at version 8.0.200, after I upgraded it to the 8.0.201 the issue is resolved. Thanks for the tips.