アプリ内購入を追加したアプリを作成し、テスト用にベータ版としてアップロードしました。
アプリ内購入のコードは次のとおりです。
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;
}
}
ベータ ビルドをインストールしている間に、購入ボタンをクリックしました。購入場所に行きます。
インストールまたはキャンセルを求められます。
インストールまたはキャンセルを指定すると、アプリが強制終了されます。
私がした間違いは何ですか。誰かがこれを解決するのを手伝ってくれますか????