IAP 不适用于 Win10Mobile 的 UWP 应用程序
IAP not working on UWP apps for Win10Mobile
我开发了一个包含 IAP 的免费 UWP 应用程序。
我为 Windows 10 Mobile 开发了这个应用程序。 我向名为 customBackground 的商店发布了一个 IAP,并发布了我的应用程序以及商店的 IAP。
两者都发布后,我从商店下载了我发布的应用程序并尝试购买 IAP。
然而,它返回了一个系统弹出窗口,提示“此应用内商品在 MY-APP-NAME 中不再可用”。我不知道为什么会这样。
存在问题:
当我在 visual studio 中使用 CurrentAppSimulator class 在调试模式下尝试时,它不会弹出购买状态选择在我的 phone 或模拟器上,但它会在桌面版本上弹出。它只读取 WindowsStoreProxy.xml.
中的存储状态
我也试过在 IAP 发布后在 debug/release 模式下使用 CurrentApp class,但没有成功,它returns和商城版本一样的错误
Package.appxmanifest 中的互联网权限已启用。
这是我在商店中发布的应用程序中的代码:
private async void buy_Click(object sender, RoutedEventArgs e)
{
LicenseInformation licenseInformation = CurrentApp.LicenseInformation;
if (!licenseInformation.ProductLicenses["customBackground"].IsActive)
{
Debug.WriteLine("Buying this feature...");
try
{
await CurrentApp.RequestProductPurchaseAsync("customBackground");
if (licenseInformation.ProductLicenses["customBackground"].IsActive)
{
var purchaseStat = LocalizedStrings.GetString(LocalizedStringEnum.havePurchased);
var b = new MessageDialog(purchaseStat);
b.ShowAsync();
Debug.WriteLine("You bought this feature.");
isIAPValid = true;
}
else
{
var purchaseStat = LocalizedStrings.GetString(LocalizedStringEnum.notPurchased);
var b = new MessageDialog(purchaseStat);
b.ShowAsync();
Debug.WriteLine("this feature was not purchased.");
}
}
catch (Exception)
{
var purchaseStat = LocalizedStrings.GetString(LocalizedStringEnum.purchaseFailed);
var b = new MessageDialog(purchaseStat);
b.ShowAsync();
Debug.WriteLine("Unable to buy this feature.");
}
}
else
{
var purchaseStat = LocalizedStrings.GetString(LocalizedStringEnum.alreadyOwned);
var b = new MessageDialog(purchaseStat);
b.ShowAsync();
Debug.WriteLine("You already own this feature.");
isIAPValid = true;
}
}
谢谢!
一天后,我发现我的 iap 正在工作。
看来是暂时的问题,微软确实需要改进他们的商店系统。
我开发了一个包含 IAP 的免费 UWP 应用程序。
我为 Windows 10 Mobile 开发了这个应用程序。 我向名为 customBackground 的商店发布了一个 IAP,并发布了我的应用程序以及商店的 IAP。
两者都发布后,我从商店下载了我发布的应用程序并尝试购买 IAP。
然而,它返回了一个系统弹出窗口,提示“此应用内商品在 MY-APP-NAME 中不再可用”。我不知道为什么会这样。
存在问题:
当我在 visual studio 中使用 CurrentAppSimulator class 在调试模式下尝试时,它不会弹出购买状态选择在我的 phone 或模拟器上,但它会在桌面版本上弹出。它只读取 WindowsStoreProxy.xml.
中的存储状态
我也试过在 IAP 发布后在 debug/release 模式下使用 CurrentApp class,但没有成功,它returns和商城版本一样的错误
Package.appxmanifest 中的互联网权限已启用。
这是我在商店中发布的应用程序中的代码:
private async void buy_Click(object sender, RoutedEventArgs e)
{
LicenseInformation licenseInformation = CurrentApp.LicenseInformation;
if (!licenseInformation.ProductLicenses["customBackground"].IsActive)
{
Debug.WriteLine("Buying this feature...");
try
{
await CurrentApp.RequestProductPurchaseAsync("customBackground");
if (licenseInformation.ProductLicenses["customBackground"].IsActive)
{
var purchaseStat = LocalizedStrings.GetString(LocalizedStringEnum.havePurchased);
var b = new MessageDialog(purchaseStat);
b.ShowAsync();
Debug.WriteLine("You bought this feature.");
isIAPValid = true;
}
else
{
var purchaseStat = LocalizedStrings.GetString(LocalizedStringEnum.notPurchased);
var b = new MessageDialog(purchaseStat);
b.ShowAsync();
Debug.WriteLine("this feature was not purchased.");
}
}
catch (Exception)
{
var purchaseStat = LocalizedStrings.GetString(LocalizedStringEnum.purchaseFailed);
var b = new MessageDialog(purchaseStat);
b.ShowAsync();
Debug.WriteLine("Unable to buy this feature.");
}
}
else
{
var purchaseStat = LocalizedStrings.GetString(LocalizedStringEnum.alreadyOwned);
var b = new MessageDialog(purchaseStat);
b.ShowAsync();
Debug.WriteLine("You already own this feature.");
isIAPValid = true;
}
}
谢谢!
一天后,我发现我的 iap 正在工作。 看来是暂时的问题,微软确实需要改进他们的商店系统。