模拟Windows 8商店应用购买
我正在尝试将模拟购买的代码放在一起,用于Windows 8(商店)应用。
代码非常简单并使用Windows API:
var result = await CurrentAppSimulator.RequestProductPurchaseAsync("product", true); // this is still false... var active = CurrentAppSimulator.LicenseInformation.ProductLicenses["product"].IsActive;
第一个调用打开对话框,允许我模拟购买的返回代码。
即使我选择S_OK,下一行仍会检查许可证是否处于活动状态并返回false。
这有什么不对?
您是否正在更新WindowsStoreProxy.xml
文件? 您必须这样做,否则购买永远不会被设置为活动。 您不需要调用RequestAppPurchaseAsync...
只需要requestProductPurchaseAsync.
做这个…
在调试模式下运行应用程序,打破任何地方打开QuickWatch(SHIFT + F9)并输入Windows.Storage.ApplicationData.current.roamingFolder.path并复制值(我的是C:\Users\jerfost\AppData\Local\Packages\{package name}\LocalState
浏览到该位置并打开Microsoft \ Windows Store \ ApiData目录在文本编辑器中打开WindowsStoreProxy.xml
文件将CurrentApp/LicenseInformation/App/IsTrial
更改为false将CurrentApp/ListingInformation/Product/MarketData/Name
更改为您的独特的产品名称应该这样做。希望有所帮助。
您不必每次都手动编辑XML,CurrentAppSimulator会自动进行编辑。
只需检查WindowsStoreProxy.xml中的设置,并确保’IsTrial’设置为’false’ –
true false false
请记住 – 应用内购买在应用的试用版中无效。
- 如何根据驻留在updatePanel中的DataGrid中的行选择更新控件?
- 为Windows 8 Store App启用“Toast Notifications”
- FileIO.ReadTextAsync偶尔会挂起
- 使用.Net技术开发智能卡读卡器
- 如何禁用Suspending || 关闭|| 在Windows 8 Pro上终止Metro风格应用程序的事件
- 这是三元运算符的合理使用吗?
- 等待httpClient.SendAsync(httpContent)无响应
- 在asp.net 3.5中使用RegisterClientScriptBlock / RegisterStartupScript
- 如何为MSMQ创建C#侦听器服务作为Windows服务