0

我想为 Xamarin Forms Windows 8.1 Silverlight 项目配置推送通知。最初我使用的是 MPNS,但正在尝试切换到 WNS。切换我现在在尝试调用方法以将我的设备注册到 Azures 通知中心时遇到错误。

引发错误的即时调用行是:

await App.MobileService.GetPush().RegisterAsync(channel.Uri);

抛出的错误是:

The type name 'MobileService' does not exist in the type 'App'

我安装了 NuGet 包 Microsoft.WindowsAzure.MobileServices 但显然这不包含定义。

我正在按照以下指南设置我的推送通知(在“将推送通知添加到您的应用程序”部分下):

https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-windows-store-dotnet-get-started-push/

我还查看了如何在其他网站上执行此操作,但我没有看到说明有太大差异,也没有看到我可能遗漏的内容......

无论如何,如果有人知道我可能缺少什么包或参考(或者该调用可能有什么问题),我将不胜感激!谢谢!

4

1 回答 1

0

万一有人遇到这个问题,我解决了这个问题,添加:

public static MobileServiceClient MobileService = new MobileServiceClient(Utilities.Constants.ApplicationURL, Utilities.Constants.ApplicationKey);

并像这样更新我的电话:

await MobileService.GetPush().RegisterNativeAsync(channelUri);

希望这可以帮助!

于 2016-02-22T14:12:04.737 回答