Skype Web SDK登录无效

时间:2015-09-17 14:45:20

标签: javascript jquery skype skypedeveloper

我使用来自https://msdn.microsoft.com/EN-US/library/dn962162(v=office.16).aspx的Skype SDK入口点源并尝试登录Skype,但我一直遇到其中一个Skype功能的问题。我目前有两个文本字段,它们有自己的ID值(#username和#password),我有2个按钮(#signin和#signout)。

$(function () {
    'use strict';    // create an instance of the Application object;
    // note, that different instances of Application may
    // represent different users
    var Application
    var client;
    Skype.initialize({
        apiKey: 'SWX-BUILD-SDK',
    }, function (api) {
        Application = api.application;
        client = new Application();
    }, function (err) {
        alert('some error occurred: ' + err);
    });
    // whenever state changes, display its value    
    client.signInManager.state.changed(function (state) {
        $('#application_state').text(state);
    });
    // when the user clicks on the "Sign In" button    
    $('#signin').click(function () {
    // start signing in
    client.signInManager.signIn({
        username: $('#username').text(),
        password: $('#password').text()
    }).then(
        //onSuccess callback
        function () {
            // when the sign in operation succeeds display the user name
            alert('Signed in as ' + client.personsAndGroupsManager.mePerson.displayName());
        }, 
        //onFailure callback
        function (error) {
            // if something goes wrong in either of the steps above,
            // display the error message
            alert(error || 'Cannot sign in');
        });
    });

// when the user clicks on the "Sign Out" button
$('#signout').click(function () {
    // start signing out
    client.signInManager.signOut()
        .then(
            //onSuccess callback
            function () {
                // and report the success
                alert('Signed out');
            }, 
        //onFailure callback
        function (error) {
            // or a failure
            alert(error || 'Cannot sign in');
        });
});
});

我从msdn网站上获取了js内容的副本,如下所示,

// from content View of activity or fragment
    listView = (LinearLayout) findViewById(R.id.sos_list_view);

    listView.removeAllViews();
    List<SosObject> sosList = batabase.getAllItems();

            for(SosObject t: sosList) {
                LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

// Item layout 
                View view = inflater.inflate(R.layout.sos_prewivew_item, null);

                TextView comment = (TextView) view.findViewById(R.id.sos_comment_text);
                TextView date = (TextView) view.findViewById(R.id.sos_date_text);
                TextView id = (TextView) view.findViewById(R.id.sos_answer_id);
                TextView tittle = (TextView) view.findViewById(R.id.answer_tittle);

                listView.addView(view);
            }
        }

加载我的html页面时出现错误,我得到以下错误, &#34;未捕获的TypeError:无法读取属性&#39; signInManager&#39;未定义&#34;。它指向错误的行是&#34; client.signInManager.state.changed(function(state){&#34;。我可以看到&#39; signInManager&#39;在SDK-build中。 js文件,由swx.cdn.skype.com/vs/SDK-build.js正确选取,所以我不知道怎么解决这个问题,有没有人对如何解决这个问题有任何想法这个问题?

1 个答案:

答案 0 :(得分:1)

问题似乎与2个jquery库的引用有关,其中一个比另一个更旧。删除了旧引用,错误消息现已消失。