gpt4 book ai didi

azure - 我现在应该如何使用带 PCL 或不带 PCL 的 Azure 移动服务?

转载 作者:行者123 更新时间:2023-12-04 01:51:35 26 4
gpt4 key购买 nike

我更新到了最新版本的 Xamarin,其中“完全支持”PCL。我现在如何使用 Azure 移动服务?

如果我创建 PCL 库并尝试使用 NuGet 添加它,则无法安装“Newtonsoft.Json 5.0.8”,因为它需要缺少“portable-net45+wp80+MonoAndroid10+MonoTouch10”。

如果我创建简单的 android lib 并从组件添加 Azure,则会生成异常:

System.InvalidOperationException: A Windows Azure Mobile Services assembly for the current platform was not found. Ensure that the cur…

 public static MobileServiceClient MobileService = new MobileServiceClient(
"https://no-link-here.azure-mobile.net/",
"no-key-here");

最佳答案

首先,请确保您使用的是 NuGet 或 Xamarin 组件 1.1.5 或更高版本,因为以前的版本在 PCL 支持方面存在一些问题。

有关在 PCL 中使用移动服务的分步指南,请参阅 this tutorial

如果您安装 Xamarin ComponentNuGet package为了将 Azure 移动服务添加到您的 Android 应用程序中,您会发现它添加了这些引用(以及其他引用):

  • Microsoft.WindowsAzure.Mobile.dll
  • Microsoft.WindowsAzure.Mobile.Ext.dll

第一个程序集是 PCL,第二个程序集具有特定于平台的实现(这就是上面的错误消息中缺少的内容)。

移动服务的 NuGet 包具有为 Xamarin.iOS 和 Xamarin.Android 定义的特定平台目标,因此如果您使用 Visual Studio,则可以选择仅使用 NuGet 并完全跳过 Xamarin 组件。

由于 BCL NuGet 包(HttpClient、Bcl.Build 等)与 Xamarin 交互的方式存在一些错误,因此您需要注意一些解决方法。请参阅上面的教程以了解必要的步骤。

关于azure - 我现在应该如何使用带 PCL 或不带 PCL 的 Azure 移动服务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20226332/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com