.NET Maui won't run application on iOS

Viewed 221

So I've got a simple app that works on the Android emulator and physical Opel phone, but when I deploy to iPhone I getting a bunch of errors. For starters...

Could not resolve assembly Microsoft.VisualStudio.DesignTools.TapContract

Surely a tap gesture should work out of the box?

Here's the full list:

2022-08-22 23:14:34.473 Xamarin.PreBuilt.iOS[94921:6409975] Could not resolve assembly Microsoft.VisualStudio.DesignTools.TapContract, Version=17.0.0.0, Culture=neutral, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/6B3B6CF6-2A5A-452F-956D-74D8A66941EA/Documents/Lofty.Logbook.content/Microsoft.VisualStudio.DesignTools.TapContract.dll' or one of its dependencies.

2022-08-22 23:14:34.475 Xamarin.PreBuilt.iOS[94921:6409975] Could not resolve assembly Xamarin.HotReload.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/6B3B6CF6-2A5A-452F-956D-74D8A66941EA/Documents/Lofty.Logbook.content/Xamarin.HotReload.Contracts.dll' or one of its dependencies.

Resolved pending breakpoint for 'Xamarin.HotReload.HotReloadAgent.BreakpointSendToIde(System.String)' to D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:419 [0x00000].
2022-08-22 23:14:34.617 Xamarin.PreBuilt.iOS[94921:6409975] Could not resolve assembly Xamarin.HotReload.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/6B3B6CF6-2A5A-452F-956D-74D8A66941EA/Documents/Lofty.Logbook.content/Xamarin.HotReload.Contracts.dll' or one of its dependencies.

2022-08-22 23:14:34.618 Xamarin.PreBuilt.iOS[94921:6409975] Could not resolve assembly Microsoft.VisualStudio.DesignTools.TapContract, Version=17.0.0.0, Culture=neutral, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/6B3B6CF6-2A5A-452F-956D-74D8A66941EA/Documents/Lofty.Logbook.content/Microsoft.VisualStudio.DesignTools.TapContract.dll' or one of its dependencies.

Resolved pending breakpoint for 'Xamarin.HotReload.HotReloadAgent.BreakpointCheckpoint()' to D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:414 [0x00000].
Resolved pending breakpoint at 'MauiProgram.cs:40,1' to Lofty.Logbook.Database.EntityDbContext Lofty.Logbook.MauiProgram.<>c__DisplayClass0_0.<CreateMauiApp>b__1 (System.IServiceProvider x) [0x00058].
Resolved pending breakpoint at 'MauiProgram.cs:32,1' to Lofty.Logbook.Database.EntityDbContext Lofty.Logbook.MauiProgram.<>c__DisplayClass0_0.<CreateMauiApp>b__1 (System.IServiceProvider x) [0x00023].
Thread started:  #7
Thread started:  #8
Thread started:  #9
2022-08-22 23:14:35.102 Xamarin.PreBuilt.iOS[94921:6409975] Could not resolve assembly System.Private.DataContractSerialization.resources, Version=6.0.0.0, Culture=en-AU, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/6B3B6CF6-2A5A-452F-956D-74D8A66941EA/Documents/Lofty.Logbook.content/System.Private.DataContractSerialization.resources.dll' or one of its dependencies.

2022-08-22 23:14:35.103 Xamarin.PreBuilt.iOS[94921:6409975] Could not resolve assembly System.Private.DataContractSerialization.resources, Version=6.0.0.0, Culture=en, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/6B3B6CF6-2A5A-452F-956D-74D8A66941EA/Documents/Lofty.Logbook.content/System.Private.DataContractSerialization.resources.dll' or one of its dependencies.

2022-08-22 23:14:35.247 Xamarin.PreBuilt.iOS[94921:6409975] Could not resolve assembly Microsoft.EntityFrameworkCore.resources, Version=6.0.8.0, Culture=en-AU, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/6B3B6CF6-2A5A-452F-956D-74D8A66941EA/Documents/Lofty.Logbook.content/Microsoft.EntityFrameworkCore.resources.dll' or one of its dependencies.

2022-08-22 23:14:35.248 Xamarin.PreBuilt.iOS[94921:6409975] Could not resolve assembly Microsoft.EntityFrameworkCore.resources, Version=6.0.8.0, Culture=en, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/6B3B6CF6-2A5A-452F-956D-74D8A66941EA/Documents/Lofty.Logbook.content/Microsoft.EntityFrameworkCore.resources.dll' or one of its dependencies.

    [0:] An error occurred: 'e_sqlite3'. Callstack: '   at SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_libversion_number()
       at SQLitePCL.raw.SetProvider(ISQLite3Provider imp)
       at SQLitePCL.Batteries_V2.Init()
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)'
    The app has been terminated.

Anyone know how to resolve this? I'm guessing sqlite pcl is the main issue

Update: Here's a demo project that illustrates the issue I'm facing. https://github.com/steveski/MauiEFIssue

1 Answers

You need add a new entitlements file to your .NET Multi-platform App UI (.NET MAUI) app project, and add a new XML file named Entitlements.plist to the Platforms\iOS\ folder of your app project. Then add the following XML to the file:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>

Update: I found a working example, you can refer to it.

Related