【发布时间】:2014-05-05 20:59:31
【问题描述】:
好的,所以我觉得我几乎可以完成这项工作。我设置了 WP8 商店应用程序(作为测试版),密钥在应用程序内是正确的。如果这是相关的,我正在使用 MonoGame 并在从更新线程启动的单独任务中进行调用。
当应用启动时,我会像这样加载许可证信息
mProductList = await CurrentApp.LoadListingInformationAsync();
foreach (var product in mProductList.ProductListings)
{
Debug.WriteLine(string.Format("{0}, {1}, {2}, {3}, {4}",
product.Key,
product.Value.Name,
product.Value.FormattedPrice,
product.Value.ProductType,
product.Value.Description));
}
这部分工作正常(调试列表部分是我从教程中借来的,所以不是我写的)。这行得通,信息显示正确。
diamond_pack_small, Small diamond pack (beta), $0.00, Consumable, Small diamonds. In a pack.
但是,当我调用实际购买方法时如下图所示:
public async Task<IAPPurchase> BuyProduct(string identifier)
{
if (!CurrentApp.LicenseInformation.ProductLicenses.ContainsKey(identifier))
{
string receipt = null;
try
{
receipt = await CurrentApp.RequestProductPurchaseAsync(identifier, true);
}
catch (Exception e)
{
if (Debugger.IsAttached)
Debugger.Break();
return null;
}
我的调试器在这里中断
Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
我在这里不知所措。堆栈跟踪显示了这么多:
at Windows.ApplicationModel.Store.CurrentApp.RequestProductPurchaseAsync(String productId, Boolean includeReceipt)
我检查了 product.Key 是否与传递给 BuyProduct 的标识符相对应。
【问题讨论】:
标签: windows-phone-8 in-app-purchase