无法在 Mac 上为 iOS 运行 Uno 项目 - 无法加载 `SQLitePCLRaw.core`

Unable to run Uno project for iOS on Mac - unable to load `SQLitePCLRaw.core`

我有一个 UWP 应用程序,我使用 Uno 平台移植到 iOS & Android。我可以在 Windows 上构建 运行 iOS 项目,但是当我尝试在 Mac 上构建 运行 项目时,出现以下错误:

Error: System.TypeLoadException: Could not load type of field 'Microsoft.CodeAnalysis.SQLite.Interop.SqlConnection:_handle' (0) due to: Could not load file or assembly 'SQLitePCLRaw.core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1488e028ca7ab535' or one of its dependencies.

即使我添加了对此包的引用,错误仍然存​​在并且我无法 运行 该项目。完整的堆栈跟踪如下:

      at (wrapper managed-to-native) System.RuntimeType.GetPropertiesByName_native(System.RuntimeType,intptr,System.Reflection.BindingFlags,bool)
      at System.RuntimeType.GetPropertiesByName (System.String name, System.Reflection.BindingFlags bindingAttr, System.Boolean icase, System.RuntimeType reflectedType) [0x00011] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/mcs/class/corlib/ReferenceSources/RuntimeType.cs:516 
      at System.RuntimeType.GetPropertyCandidates (System.String name, System.Reflection.BindingFlags bindingAttr, System.Type[] types, System.Boolean allowPrefixLookup) [0x00010] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/rttype.cs:2881 
      at System.RuntimeType.GetProperties (System.Reflection.BindingFlags bindingAttr) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/rttype.cs:3089 
      at System.Reflection.RuntimeReflectionExtensions.GetRuntimeProperties (System.Type type) [0x00006] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/reflection/RuntimeReflectionExtensions.cs:25 
      at System.Composition.TypedParts.Discovery.TypeInspector+<DiscoverPropertyExports>d__7.MoveNext () [0x00030] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
      at System.Composition.TypedParts.Discovery.TypeInspector+<DiscoverExports>d__5.MoveNext () [0x000dc] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
      at System.Composition.TypedParts.Discovery.TypeInspector.InspectTypeForPart (System.Reflection.TypeInfo type, System.Composition.TypedParts.Discovery.DiscoveredPart& part) [0x00061] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
      at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor (System.Collections.Generic.IEnumerable`1[T] types, System.Composition.Convention.AttributedModelProvider attributeContext) [0x00037] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
      at System.Composition.Hosting.ContainerConfiguration.CreateContainer () [0x00042] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
      at Microsoft.CodeAnalysis.Host.Mef.MefHostServices.Create (System.Collections.Generic.IEnumerable`1[T] assemblies) [0x0001e] in <c187f126c4894c9b948a9aabdfa3b3e0>:0 
      at Microsoft.CodeAnalysis.Host.Mef.DesktopMefHostServices.get_DefaultServices () [0x00011] in <7dc846b9b711473199b9a1835d0b3ea9>:0 
      at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.Create (System.Collections.Generic.IDictionary`2[TKey,TValue] properties) [0x00000] in <7dc846b9b711473199b9a1835d0b3ea9>:0 
      at Uno.SourceGeneration.Host.SourceGeneratorHost.GetCompilation () [0x00125] in <a8efa0c74d824a2d829abc1245eef090>:0  (UnoSample.iOS)

我使用的是 Uno.Platform 的最新发布版本(未预发布):

  <package id="Uno.CodeGen" version="1.29.0" targetFramework="xamarinios10" />
  <package id="Uno.Core" version="1.25.0" targetFramework="xamarinios10" />
  <package id="Uno.Core.Build" version="1.25.0" targetFramework="xamarinios10" />
  <package id="Uno.Equality" version="1.29.0" targetFramework="xamarinios10" />
  <package id="Uno.Immutables" version="1.29.0" targetFramework="xamarinios10" />
  <package id="Uno.Injectable" version="1.29.0" targetFramework="xamarinios10" />
  <package id="Uno.SourceGenerationTasks" version="1.28.0" targetFramework="xamarinios10" />
  <package id="Uno.UI" version="1.42.0" targetFramework="xamarinios10" />

是否可以运行 iOS 应用程序,使用 Uno 平台在 Mac 上开发?

正如安德烈斯所提到的,这已在最新的开发中得到修复。如果需要,您可以在我们的 Gitter 频道上获得更多帮助:https://gitter.im/uno-platform/Lobby#

我尝试将 Uno.UI 软件包更新到最新的预发布版 - 但没有帮助。我不仅要更新 Uno.UI 包,还要手动更新所有未使用 Uno.UI:

拉取的相关包
  <package id="Uno.CodeGen" version="1.30.0-dev.107" targetFramework="xamarinios10" />
  <package id="Uno.Core" version="1.26.0-dev.61" targetFramework="xamarinios10" />
  <package id="Uno.Core.Build" version="1.26.0-dev.61" targetFramework="xamarinios10" />
  <package id="Uno.Equality" version="1.30.0-dev.107" targetFramework="xamarinios10" />
  <package id="Uno.Immutables" version="1.30.0-dev.107" targetFramework="xamarinios10" />
  <package id="Uno.Injectable" version="1.30.0-dev.107" targetFramework="xamarinios10" />
  <package id="Uno.Roslyn" version="1.2.0-dev.18" targetFramework="xamarinios10" />
  <package id="Uno.SourceGenerationTasks" version="1.29.0-dev.226" targetFramework="xamarinios10" />
  <package id="Uno.UI" version="1.43.0-dev.614" targetFramework="xamarinios10" />

这个软件包列表工作正常。