【问题标题】:Purchase simulation dialog does not show up (CurrentAppSimulator.RequestProductPurchaseAsync)购买模拟对话框不显示 (CurrentAppSimulator.RequestProductPurchaseAsync)
【发布时间】:2016-02-08 13:19:39
【问题描述】:

我正在为 Windows 8 开发一个应用程序。一段时间后,我将项目更新到 Windows 8.1 并收到警告,即来自 @987654321 的方法 CurrentAppSimulator.RequestProductPurchaseAsync(String, Boolean) @ 已弃用。所以我开始使用它的 CurrentAppSimulator.RequestProductPurchaseAsync(String) 版本,由于某种原因,购买模拟对话框根本没有出现。 Here is a dialog I was getting using deprecated version of the method.

我以前从不需要 WindowsStoreProxy.xml,但以防万一我检查了它并将 IsTrial 属性设置为 false - 但是,对话框没有显示, 新方法 CurrentAppSimulator.RequestProductPurchaseAsync(String) 的答案总是返回 ProductPurchaseStatus::NotPurchased

也许有人知道问题出在哪里?

【问题讨论】:

  • 如果我能明白为什么这被标记为simulation,我会被诅咒的。这其中的哪些方面与模拟相关或特定于模拟?
  • 这是微软提供的一个模拟应用内产品购买的类(CurrentAppSimulator)。是的,也许标签与我的要求不太相关,我会改变它:)

标签: windows-8 windows-store-apps in-app-purchase windows-8.1 simulation


【解决方案1】:

返回 NotPurchased,因为 CurrentAppSimulator 使用的文件 WindowsStoreProxy.xml 不包含请求的产品。您需要使用您提供给应用用户的所有产品来填写 WindowsStoreProxy.xmlHere are some examples, written by Microsoft.

WindowsStoreProxy.xml 是在此位置首次启动应用程序时创建的:

C:\Users\<username>\AppData\Local\Packages\<app package folder>\LocalState\Microsoft\Windows Store\ApiData\WindowsStoreProxy.xml

此外,在每次 CurrentAppSimulator.RequestProductPurchaseAsync(String) 调用之后,当结果为 ProductPurchaseStatus.Succeeded 时,您需要做两件事:

  1. 向用户授予产品(例如购买的商品)
  2. 通知商店,产品履行已成功完成 - 使用方法 CurrentApp.ReportConsumableFulfillmentAsync(String, Guid)。确保之后返回的 FulfillmentResultFulfillmentResult::Succeeded

完成这些步骤后,您的商品应已成功购买并发货。

查看详细说明:Enable consumable in-app product purchases

如果您需要更清楚地了解每个 FulfillmentResult 对购买的意义,您可以在 Adam Nathan 的“Universal Windows Apps with XAML and C# Unleashed”一书中找到非常好的解释,我在谷歌搜索这些东西时发现的。

【讨论】:

    猜你喜欢
    • 2012-09-08
    • 1970-01-01
    • 1970-01-01
    • 2020-02-17
    • 1970-01-01
    • 2013-02-13
    • 2016-02-25
    • 1970-01-01
    相关资源
    最近更新 更多