0

Dans mon application Windows universelle, je teste les achats iap. Je l'ai déjà fait dans une autre application, et cela a fonctionné. Je n'ai aucune idée pourquoi ça ne marche pas cette fois. Voici le code:ReloadSimulatorAsync produit «La valeur ne se situe pas dans la plage prévue» exception

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); 

Et ReloadSimulatorAsync produit « La valeur ne tombe pas dans la plage attendue » d'exception! Supposons que c'est quelque chose à voir avec l'analyse syntaxique xml, mais bien sûr, le fichier existe et a le format:

<?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> 

Pourquoi cela pourrait se produire?

Répondre

1

Je peux reproduire votre problème si j'utilise le XML que vous avez fourni, car AppId peut ne pas être correct, vous devrez peut-être donner GUID. Vous pouvez remplacer le [mon ID d'application] par 988b90e4-5d4d-4dea-99d0-e423e414ffbc Microsoft fourni et essayez à nouveau.

Pour plus d'informations sur XML, vous pouvez vous reporter à in-app purchase. Je trouve également Store sample(demonstrates trials and in-app purchase), vous pouvez vous référer à.

Voici mon XML:

<?xml version="1.0" encoding="utf-16" ?> 
<CurrentApp> 
    <ListingInformation> 
<App> 
    <AppId>988b90e4-5d4d-4dea-99d0-e423e414ffbc</AppId> 
    <LinkUri>http://apps.microsoft.com/webpdp/app/988b90e4-5d4d-4dea-99d0-e423e414ffbc</LinkUri> 
    <CurrentMarket>en-us</CurrentMarket> 
    <AgeRating>3</AgeRating> 
    <MarketData xml:lang="en-us"> 
    <Name>In-app purchases</Name> 
    <Description>AppDescription</Description> 
    <Price>5.99</Price> 
    <CurrencySymbol>$</CurrencySymbol> 
    <CurrencyCode>USD</CurrencyCode> 
    </MarketData> 
</App> 
<Product ProductId="product1"> 
    <MarketData xml:lang="en-us"> 
    <Name>Product 1</Name> 
    <Price>1.99</Price> 
    <CurrencySymbol>$</CurrencySymbol> 
    <CurrencyCode>USD</CurrencyCode> 
    </MarketData> 
</Product> 
<Product ProductId="product2"> 
    <MarketData xml:lang="en-us"> 
    <Name>Product 2</Name> 
    <Price>2.99</Price> 
    <CurrencySymbol>$</CurrencySymbol> 
    <CurrencyCode>USD</CurrencyCode> 
    </MarketData> 
</Product> 
    </ListingInformation> 
<LicenseInformation> 
<App> 
    <IsActive>true</IsActive> 
    <IsTrial>false</IsTrial> 
</App> 
<Product ProductId="product1"> 
    <IsActive>true</IsActive> 
</Product> 
<Product ProductId="product2"> 
    <IsActive>false</IsActive> 
    </Product> 
</LicenseInformation> 
</CurrentApp> 
+0

Merci! Mais où puis-je trouver le guid? Sur les détails de l'application, je ne peux voir que le nom de famille et le lien du marché avec l'index des lettres, mais ce n'est pas un guide. – Tertium

+0

ah, je viens de trouver - vous pouvez utiliser n'importe quel guid pour les tests. Va vérifier quand je reçois à l'ordinateur – Tertium

+0

avec guid guida finalement travaillé. Je pense qu'il utilise un code hérité (Windows Phone 7+), lorsque vous deviez utiliser guid au lieu de l'ID de la famille, donc guid est nécessaire. – Tertium