UWP - HRESULT 异常:0x80131040

UWP - Exception from HRESULT: 0x80131040

我正在尝试使用 oneSignal 推送通知 sdk 8.1+ 但出现此异常。 看到这个:Windows Phone SDK Installation

这是否意味着我不能将它与 uwp 应用程序一起使用?

异常:

Could not load file or assembly 'System.ComponentModel.DataAnnotations,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of
its dependencies. The located assembly's manifest definition does not match
the assembly reference. (Exception from HRESULT: 0x80131040)

代码:

protected override void OnLaunched(LaunchActivatedEventArgs e) {   
    OneSignal.Init("OneSignal_App_Id", e, notificationOpened);
}

private void notificationOpened(string message, IDictionary<string, string> additionalData, bool isActive) {
    System.Diagnostics.Debug.WriteLine("notificationOpened:message:" + message);
    System.Diagnostics.Debug.WriteLine("notificationOpened:additionalData:" + additionalData);
    System.Diagnostics.Debug.WriteLine("notificationOpened:isActive:" + isActive);
}

Does it mean I can't use it with uwp app ?

好像是这样,我们不能在 UWP 应用程序中使用它。

do you have any suggestion for uwp free push Service ?

老实说,我不知道是否还有其他免费的 UWP 推送服务,我可以建议的是在 Azure 应用服务中使用带有 Azure 通知中心的移动应用程序。这里是官方文档Add push notifications to your Windows app。通知中心是免费的,但您需要 azure 帐户进行开发,这不是免费的。虽然它可能会产生一些成本,但 azure notification hubs 更稳定、更高效。

他们计划为 UWP 实施它,但没有任何时间表。我想我们能做的就是等待。

要在 UWP 项目上使用 OneSignal WP 8.1 SDK,只需在发布模式下编译和测试项目!!