我正在尝试从此处复制此示例应用中的功能:http://code.msdn.microsoft.com/windowsapps/Licensing-API-Sample-19712f1a
进入我写的应用程序。我开始着手实施购买消耗品的能力。
到目前为止我做了什么:
1。)将函数体复制到我的“购买”按钮的事件处理程序中。
2.。)从工作示例中复制WindowsStoreProxy.xml以替换我项目中的那个。
3。)双重和三重检查试用模式是否错误。
注意:
CurrentAppSimulator.RequestProductPurchaseAsync("product2");
没有调出gui来选择我的项目代码中的返回代码(它在示例中做了)。将“product2”更改为“2”可以解决该问题。但是,当等待的RequestProductPurchaseAsync返回时,表达式如下:
licenseInformation.ProductLicenses["2"].IsActive
在样本中说它应该是真的时仍然是假的,所以我的代码永远不会成功。
答案 0 :(得分:0)
您是否正在将WindowsStoreProxy.xml读入模拟器?
StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("data");
StorageFile proxyFile = await proxyDataFolder.GetFileAsync("WindowsStoreProxy.xml");
await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile);