シミュレーターでアプリ購入のテストを実装しようとしましたが、すべて無駄でした。ストアの例は機能しますが、アプリに同様の動作を実装しようとすると、どういうわけか思い通りにシミュレートされません。プレミアム機能として作成する必要がある設定ページとすべてのメモ ページがあります。アプリはデフォルトで無料です。
これは私のxmlファイルです。サンプルアプリにあるものをそのまま作成しました。私のアプリはデフォルトで無料なので必要ですか?
<?xml version="1.0" encoding="utf-8" ?>
<CurrentApp>
<LicenseInformation>
<App>
<IsActive>true</IsActive>
<IsTrial>false</IsTrial>
</App>
<Product ProductId="Settings">
<IsActive>true</IsActive>
</Product>
<Product ProductId="AllNotes">
<IsActive>false</IsActive>
</Product>
</LicenseInformation>
</CurrentApp>
コードの残りの部分は、設定ページの OnNavigatedTo 関数に記述されています。
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("Data");
StorageFile proxyFile = await proxyDataFolder.GetFileAsync("in-app-purchase.xml");
LicenseInformation licenseInformation = CurrentAppSimulator.LicenseInformation;
var productLicense = licenseInformation.ProductLicenses["Settings"];
if (!productLicense.IsActive)
{
var messageDialog = new MessageDialog("You need to buy the Settings option", "Buy");
messageDialog.Commands.Add(new UICommand("Buy", null, 0));
var commandChosen = await messageDialog.ShowAsync();
if ((int)commandChosen.Id == 0)
{
await CurrentAppSimulator.RequestProductPurchaseAsync("Settings", true);
if (licenseInformation.ProductLicenses["Settings"].IsActive)
{
InitializeUI();
}
}
}
}
だから商品を買おうとしても待ってる
CurrentAppSimulator.RequestProductPurchaseAsync("Settings", true);
値はまだ false です。私が見逃しているものはありますか?