Stephen York
Stephen York

Reputation: 1429

.NET Maui won't run application on iOS

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

Upvotes: 6

Views: 4551

Answers (2)

Tony
Tony

Reputation: 383

When first testing my cross-platform MAUI app (for Android and iOS), my app would not run on iOS deployed from Visual Studio 2022 (Windows 11) to a remote iPhone connected to my MacBookPro running Ventura/XCode 15.2. The solution for me was to configure Manual Provisioning with AdHoc Distribution profile. The app would appear to install correctly but would not run with Automatic provisioning. Manual provisioning is configured in Properties > iOS > Bundle Signing.

Upvotes: 1

Alexandar May - MSFT
Alexandar May - MSFT

Reputation: 10078

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.

Upvotes: 4

Related Questions