.NET Maui 无法在 iOS 上运行应用程序

Ste*_*ork 5 ios .net-maui

所以我有一个简单的应用程序,可以在 Android 模拟器和物理 Opel 手机上运行,​​但是当我部署到 iPhone 时,我遇到了一堆错误。对于初学者...

Could not resolve assembly Microsoft.VisualStudio.DesignTools.TapContract
Run Code Online (Sandbox Code Playgroud)

轻击手势肯定应该开箱即用吗?

这是完整列表:

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.
Run Code Online (Sandbox Code Playgroud)

有人知道如何解决这个问题吗?我猜 sqlite pcl 是主要问题

更新:这是一个演示项目,说明了我面临的问题。https://github.com/steveski/MauiEFissue

Ale*_*SFT 2

您需要将一个新entitlements文件添加到您的.NET Multi-platform App UI(.NET MAUI) 应用程序项目,并将一个名为Entitlements.plist的新 XML 文件添加到Platforms\iOS\您的应用程序项目的文件夹中。然后将以下 XML 添加到文件中:

<?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>
Run Code Online (Sandbox Code Playgroud)

更新:我找到了一个工作示例,你可以参考一下