升级到Windows 8发行版后无法进行应用内购买 [英] Can't in-app purchase after upgrade to Windows 8 release version

查看:77
本文介绍了升级到Windows 8发行版后无法进行应用内购买的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 


从RP升级到Win8发布版本后,我发现应用内购买不再有效。  我检查了迁移指南文档,但什么都没找到。


我创建了一个小应用来解释这个问题。由于我的应用尚未发布,我使用"Windows.ApplicationModel.Store.CurrentAppSimulator"测试应用内购买。 :

<!DOCTYPE HTML> 
< html>
< head>
< meta charset =" utf-8" />
< title> TestStore< / title>

<! - WinJS参考 - >
< link href =" // Microsoft.WinJS.1.0 / css / ui-dark.css"的rel ="样式表" />
< script src =" // Microsoft.WinJS.1.0 / js / base.js">< / script>
< script src =" // Microsoft.WinJS.1.0 / js / ui.js">< / script>

<! - TestStore references - >
< link href =" /css/default.css"的rel ="样式表" />
< script src =" /js/default.js">< / script>
< script>
var currentApp = Windows.ApplicationModel.Store.CurrentAppSimulator;
var licenseInformation = currentApp.licenseInformation;

函数init(){
test();
}
函数pmt(msg){
var ul = document.getElementById(" pmt");
ul.innerHTML + ="< li>" + msg +"< / li>" ;;
}
function test(){
if(licenseInformation.productLicenses.lookup(" testf")。isActive){
pmt(" active");
}
else {
pmt(" not active");
}
}
function buy(){
if(!licenseInformation.productLicenses.lookup(" testf")。isActive){
currentApp.requestProductPurchaseAsync(" ; testf",true).then(
function(){
pmt(" purchase ok");
},
function(){
pmt( "购买失败");
});
}
else {
pmt("已购买");
}
}


< / script>
< / head>
< body onload =" init()">

< button onclick =" test()"> test< / button>
< button onclick =" buy()"> buy< / button>

< ul id =" pmt">< / ul>
< / body>
< / html>

问题是"licenseInformation.productLicenses.lookup(" testf")。isActive"总是返回"假"无论我购买了"testf",或不。它在Win8发布预览中运行良好。



有什么想法吗?


非常感谢。



欢呼 


Alex


woodhead就像woodhead一样

解决方案

Alex,


您是否查看了新样本?


http://code.msdn.microsoft.com/ windowsapps / Licensing-API-Sample-19712f1a


-Jeff


Hi, 

After upgrading from RP to Win8 Release version, I find that the in-app purchase doesn't work anymore.  I checked the Migrating guide doc, but find nothing.

I created a small app to explain this problem. Since my app is not released yet, I test the in-app purchase with "Windows.ApplicationModel.Store.CurrentAppSimulator". :

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>TestStore</title>

    <!-- WinJS references -->
    <link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" />
    <script src="//Microsoft.WinJS.1.0/js/base.js"></script>
    <script src="//Microsoft.WinJS.1.0/js/ui.js"></script>

    <!-- TestStore references -->
    <link href="/css/default.css" rel="stylesheet" />
    <script src="/js/default.js"></script>
    <script>
        var currentApp = Windows.ApplicationModel.Store.CurrentAppSimulator;
        var licenseInformation = currentApp.licenseInformation;
                
        function init() {            
            test();
        }
        function pmt(msg) {
            var ul = document.getElementById("pmt");
            ul.innerHTML += "<li>" + msg + "</li>";
        }
        function test() {           
            if (licenseInformation.productLicenses.lookup("testf").isActive) {
                pmt("active");
            }
            else {
                pmt("not active");           
            }
        }
        function buy() {
            if (!licenseInformation.productLicenses.lookup("testf").isActive) {                
                currentApp.requestProductPurchaseAsync("testf", true).then(
                    function () {
                        pmt("purchase ok");
                    },
                    function () {
                        pmt("purchase failed");
                    });
            }
            else {
                pmt("already purchased");      
            }
        }

        
    </script>
</head>
<body onload="init()">
    
    <button onclick="test()">test</button>
    <button onclick="buy()">buy</button>

    <ul id="pmt"></ul>
</body>
</html>

The problem is "licenseInformation.productLicenses.lookup("testf").isActive" always return "false" no matter I purchased the "testf" or not. It worked well in Win8 release preview.

Any idea?

Thank you very much.

cheers 

Alex


woodhead is as woodhead does

解决方案

Alex,

Have you reviewed the new sample?

http://code.msdn.microsoft.com/windowsapps/Licensing-API-Sample-19712f1a

-Jeff


这篇关于升级到Windows 8发行版后无法进行应用内购买的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆