代码之家  ›  专栏  ›  技术社区  ›  Yanayaya

为什么我的Xamarin Forms iOS应用程序在使用Microsoft Azure移动服务时崩溃

  •  0
  • Yanayaya  · 技术社区  · 8 年前

    我的Xamarin表单应用程序有一个奇怪的问题,我似乎无法解决,相反,我似乎在绕圈子。它似乎与我的iOS项目特别相关,并且围绕着程序集引用 Microsoft.WindowsAzure.Mobile

    系统InvalidOperationException:Microsoft Azure移动服务 未找到当前平台的程序集。确保 当前项目引用了Microsoft.WindowsAzure。移动和 以下平台特定组件: Microsoft.WindowsAzure.Mobile.Ext。

    使用的整个解决方案 Xamarin.Forms v2.3.4.247

    MyApp(便携式)

    • WindowsAzure.MobileServices 1.3.2
    • WindowsAzure.MobileService.SQLiteStore 1.0.1

    • Microsoft.Azure.Mobile.Client 4.0.1
    • Microsoft.Azure.Mobile.Client.SQLiteStore 4.0.1

    我想可能是应用程序。当我安装这些nuget软件包时,iOS项目的配置已经损坏,或者可能丢失了一些信息,所以我快速查看了一下,这一切看起来都是应该的。

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-1.5.0.0" newVersion="1.5.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="PInvoke.BCrypt" publicKeyToken="9e300f9f87f04a7a" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-0.5.0.0" newVersion="0.5.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Validation" publicKeyToken="2fc06f0d701809a7" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-2.4.0.0" newVersion="2.4.0.0" />
          </dependentAssembly>
         <dependentAssembly>
            <assemblyIdentity name="Microsoft.WindowsAzure.Mobile" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-4.2.29.0" newVersion="4.2.29.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    </configuration>
    

    如果需要的话,我可以提供更多的代码,但我希望将问题局限于我所看到的以及它报告问题的地方。有人知道这可能是什么原因吗?或者我需要做什么来解决它?可能是版本导致了问题,我应该考虑回滚吗?

    1 回复  |  直到 8 年前
        1
  •  0
  •   Bruce Chen    8 年前

    就我所知 WindowsAzure.MobileServices 现在已被弃用,并用于移动服务(类似域 ). 虽然 Microsoft.Azure.Mobile.Client 用于处理移动应用程序(应用程序服务,类似于域 ).

    有人知道这可能是什么原因吗?或者我需要做什么来解决它?可能是版本导致了问题,我应该考虑回滚吗?

    我注意到这个应用程序。iOS项目的配置具有 dependentAssembly 关于Microsoft.WindowsAzure。新版本1.3.0.0的手机。

    据我所知,你已经安装了两个WindowsAzure。MobileServices和Microsoft.Azure.Mobile。客户端软件包,我建议您使用相同的软件包来缩小这个问题。此外,在使用之前,您需要通过以下代码初始化azure mobile MobileServiceClient

    Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
    

    Microsoft.Azure.Mobile.Client 3.1.0 ,它可以按预期工作。这是关于git的示例 azure-mobile-apps-quickstarts here .

    推荐文章