【发布时间】:2017-04-07 21:21:23
【问题描述】:
在我的通用 Windows 应用程序中,我测试了 iap 购买。我之前在另一个应用程序中做过这个,它有效。不知道为什么这次它不起作用。 代码如下:
StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("Assets");
StorageFile proxyFile = await proxyDataFolder.GetFileAsync("WindowsStoreProxy.xml");
CurApp.LicenseInformation.LicenseChanged += () => Log("License info changed");
await Windows.ApplicationModel.Store.CurrentAppSimulator.ReloadSimulatorAsync(proxyFile);
并且 ReloadSimulatorAsync 产生“值不在预期范围内”异常!假设它与xml解析有关,但是文件当然存在并且具有正确的格式:
<?xml version="1.0" encoding="utf-16" ?>
<CurrentApp>
<ListingInformation>
<App>
<AppId>[my app id]</AppId>
<LinkUri>https://www.microsoft.com/store/apps/[my app store code]</LinkUri>
<CurrentMarket>en-US</CurrentMarket>
<AgeRating>7</AgeRating>
<MarketData xml:lang="en-us">
<Name>MyTestApp</Name>
<Description>AppDescription</Description>
<Price>0.0</Price>
<CurrencySymbol>$</CurrencySymbol>
</MarketData>
</App>
<Product ProductId="product2" LicenseDuration="0" ProductType="Durable">
<MarketData xml:lang="en-us">
<Name>Durable1</Name>
<Price>0.99</Price>
<CurrencySymbol>$</CurrencySymbol>
</MarketData>
</Product>
<Product ProductId="amnt1" LicenseDuration="0" ProductType="Consumable">
<MarketData xml:lang="en-us">
<Name>Consumable1</Name>
<Price>0.99</Price>
<CurrencySymbol>$</CurrencySymbol>
</MarketData>
</Product>
</ListingInformation>
<LicenseInformation>
<App>
<IsActive>true</IsActive>
<IsTrial>false</IsTrial>
</App>
<Product ProductId="product2">
<IsActive>true</IsActive>
</Product>
</LicenseInformation>
<ConsumableInformation>
<Product ProductId="amnt1" TransactionId="00000001-0000-0000-0000-000000000000" Status="Active"/>
</ConsumableInformation>
</CurrentApp>
为什么会发生这种情况?
【问题讨论】:
标签: c# windows-store-apps in-app-purchase win-universal-app windows-8.1-universal