取消在应用程序购买中不发送异常,如示例所示 [英] Canceled In App Purchase not sending back Exception as example shows

查看:76
本文介绍了取消在应用程序购买中不发送异常,如示例所示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在商店中有一个应用程序内购买选项。 我使用了这个代码示例...

I have an app in the store that has an in app purchase option.  I used this code sample...

BuyFeature1() {
    if (!licenseInformation.ProductLicenses["featureName"].IsActive)
    {
        try
								{
            // The customer doesn't own this feature, so 
            // show the purchase dialog.
								
            await CurrentProductSimulator.RequestProductPurchaseAsync("featureName");
            // the in-app purchase was successful
        }
        catch (Exception)
        {
            // The in-app purchase was not completed because the
            // customer canceled it or an error occurred.
        }
    } 
    else
    {
        // The customer already owns this feature.
    }
}


来自
这个
如何记录。 问题是如果用户单击取消而不是购买,则不会返回异常,因为它表示它在代码示例中,因此我最终显示消息"应用内购买成功"。即使它不是 。 
由于ProductLicenses未更新,因此该功能无法启用,但我不希望每次取消时都显示错误的消息。 当我使用CurrentAppSimulator时它工作正常。


RBL3

from this how to document.  The problem is if the user clicks Cancel instead of Buy an exception is not returned as it says it is in the code sample so I end up displaying the message "the in-app purchase was successful" even though it wasn't.  The feature does not enable since the ProductLicenses does not update but I don't want to be displaying the wrong message every time it's canceled.  It worked fine when I was using the CurrentAppSimulator.


RBL3

推荐答案

您可以使用此功能的收据退货。根据
文档
,你必须使用:

// result is an xml string that contains the feature that is just purchased.
var result = await CurrentProductSimulator.RequestProductPurchaseAsync("featureName", true);




希望有帮助......


hope it helps...


这篇关于取消在应用程序购买中不发送异常,如示例所示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆