检查应用程序内购买是否导致Windows Phone 8崩溃 [英] Checking In-App Purchase Leads Crash in 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屋!