4

CurrentAppSimulator でアプリ内購入をセットアップし、アプリ内購入を取得する機能をセットアップしました。また、(おそらく) これを処理するように WindowsStoreProxy.xml ファイルを構成しました。

ただし、アドオンを購入してS_OK値を返すと、IAP が非アクティブであると表示されます。アクティブにする唯一の方法は、WindowsStoreProxy.xml ファイルを手動で編集し、Active プロパティを Active に設定することです。Microsoft の Store サンプルが正常に動作するため、これはかなり奇妙に思えます。しかし、私は彼らの側に何か違うものを見ることができませんでした.彼らはまだこのCurrentAppSimulator.RequestProductPurchaseAsync()方法を使用しています. ここでどこが間違っているのでしょうか...?

4

1 に答える 1

6

まず、デバッグ モードで CurrentAppSimulator を使用し、リリース モードで CurrentApp を使用する独自のクラス CurrentAppProxy を使用します。次に、このコードを使用して InApp 購入を購入すると、問題なく動作します。

try
{
    await CurrentAppProxy.RequestProductPurchaseAsync(PremiumName, false);

    // after closing the inApp purchase dialog, test, if it was bought
    if (licenseInformation.ProductLicenses[PremiumName].IsActive)
    {
        // set the local flag
        IsPremium = true;

        dialog = new MessageDialog(resourceLoader.GetString("ThanksForPremium"));
        await dialog.ShowAsync();
    }
    // else do not show anything
}
catch (Exception)
{
    // failed buying the premium
    dialog = new MessageDialog(resourceLoader.GetString("ErrorBuyingPremium"));
    dialog.ShowAsync();
}

編集: これらのプロパティにアクセスする前に、これを使用してデバッグ モードで CurrentAppSimulator を初期化します。

StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("Assets");
StorageFile proxyFile = await proxyDataFolder.GetFileAsync("test-purchase.xml");
await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile);

そして test-purchase.xml の一番下に私が得た:

<LicenseInformation>
    <App>
        <IsActive>true</IsActive>
        <IsTrial>false</IsTrial>
    </App>
    <Product ProductId="premium">
        <IsActive>false</IsActive>
    </Product>
</LicenseInformation>
于 2012-11-14T13:01:09.407 に答える