检查应用程序内购买是否导致Windows Phone 8崩溃 [英] Checking In-App Purchase Leads Crash in windows Phone 8

查看:87
本文介绍了检查应用程序内购买是否导致Windows Phone 8崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 我创建了一个应用程序添加的应用程序内购买并上传为测试版的测试版。



这是应用程序内购买的代码。


 Private async void Purchase()
{
LicenseInformation licenseInformation = CurrentApp.LicenseInformation;
string str;
try
{
var listing = await CurrentApp.LoadListingInformationAsync();
var _price = listing.FormattedPrice;
//开始购买产品
await CurrentApp.RequestProductPurchaseAsync(" FeatureName",false);

ProductLicense productLicense = null;
if(CurrentApp.LicenseInformation.ProductLicenses.TryGetValue(" FeatureName",out productLicense))
{
if(productLicense.IsActive)
{
MessageBox.Show ("购买的产品");

CurrentApp.ReportProductFulfillment(" FeatureName");
ProductPurchased(); //显示购买的产品&触发完整版
返回;
}
其他
{
str ="购买失败" ;;
ShowErrorPopup(str); //它显示错误消息。购买失败。
返回;
}
}
}
catch(例外)
{
str ="购买失败。检查互联网连接,然后重试";
ShowErrorPopup(str);
返回;
}
}


安装测试版后,我点击了购买按钮。我转到购买点。 
$


它要求安装或取消。



通过给予安装或取消将杀死该应用程序。



我做错了什么。有人帮忙解决这个问题???? zh-b $ b

解决方案

你应该按照这些说明进行操作如果您对此过程有疑问,请告诉我们:


http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj681689(v = vs.105)的.aspx


  I created an App added In-App Purchase and uploaded it as beta for testing.

Here is the Code for In-App Purchase.

Private async void Purchase()
{
LicenseInformation licenseInformation = CurrentApp.LicenseInformation;
                string str;
                try
                {
                    var listing = await CurrentApp.LoadListingInformationAsync();
                    var _price = listing.FormattedPrice;
                    // start product purchase
                    await CurrentApp.RequestProductPurchaseAsync("FeatureName", false);

                    ProductLicense productLicense = null;
                    if (CurrentApp.LicenseInformation.ProductLicenses.TryGetValue("FeatureName", out productLicense))
                    {
                        if (productLicense.IsActive)
                        {
                            MessageBox.Show("Product purchased");
                            
                            CurrentApp.ReportProductFulfillment("FeatureName");
                             ProductPurchased();       // It display product purchased & trigger full version
                             return;
                        }
                        else
                        {
                            str = "Purchase failed";
                           ShowErrorPopup(str); // It shows error msg. purchase failed.
                           return;
                        }
                    }
                }
                catch (Exception)
                {
                    str = "Purchase failed. Check internet connection and try again";
                    ShowErrorPopup(str);
                    return;
                }
}

While installed the beta build  I clicked the purchase button. I goes to the purchase point. 

It asks for install or cancel.

By giving install or cancel will kills the app.

What is the mistake i did. Someone help to solve this????

解决方案

You should follow these instructions and let us know if you have problems with this process:

http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj681689(v=vs.105).aspx


这篇关于检查应用程序内购买是否导致Windows Phone 8崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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