Support GoogleMaps for native iOS in .net7?

121 views Asked by At

Orginally a Xamarin project (Xamarin-ios, Xamarin-Android) was migrated to .net6 according to this link.

Most of the dependencies was kept since iOS and Android still had a different codebase and .net6+ supported monoandroid(link). Since the next step was updating to .net7 there was some issues specifically with iOS Google Maps in these NuGets packages:

  • Xamarin.Google.iOS.Maps:6.0.1.1
  • Xamarin.Build.Download:0.11.4

The issues are:

  • The above NuGets only have support for xamarinios10 and net6.0-ios15.4, e.g. is officially incompatible with .net7-ios.
  • All the documentation for .net7 apps only mention multi-project .NET MAUI app, and not how to solve it natively with only MauiEssentials (previously XamarinEssentials) like this.

The questions are as following:

  1. Can this be solved by using only MauiEssentials, and if so how?
  2. Are they any other binding libs for .net7-ios GoogleMaps?
  3. What are the risks for running an "incompatible" NuGet packet since it works currently?
  4. Is the future dead for developing in .net7-ios/android and above?
1

There are 1 answers

2
Alexandar May - MSFT On

1.No.

2.You can use Maui.GoogleMaps, it's targeting .NET 7 for best experience. Get your API Keys from Google and configure for iOS as below:

using Maui.GoogleMaps.Hosting;
...
public static MauiApp CreateMauiApp()
{
        var builder = MauiApp.CreateBuilder();
        builder.UseMauiApp<App>();
            
#if ANDROID
        builder.UseGoogleMaps();
#elif IOS
        builder.UseGoogleMaps(Variables.GOOGLE_MAPS_IOS_API_KEY);
#endif
        return builder.Build(); 
}
  1. I would suggest that make sure there aren't any dependences on any Xamarin native package. For instance Xamarin.Essentials and so on.

  2. You can refer to the Roadmap and see this:https://github.com/dotnet/maui/discussions/10839