0

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

    <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'></script>
<SCRIPT type='text/javascript' SRC='https://swx.cdn.skype.com/shared/v/1.1.23.0/SkypeBootstrap.min.js'></SCRIPT>
    <TABLE CLASS='test'>
<TR><TD ALIGN=RIGHT><INPUT TYPE=TEXT class=suptabde NAME="username" ID="username" VALUE="" MAXLENGTH=40 style="width:18em">
<INPUT TYPE=PASSWORD class=testtabde NAME="password" VALUE="" MAXLENGTH=40 style="width:18em">
<BUTTON id='signin' class='testtabde' STYLE='text-align:center' VALUE='  Skype Login  '>Log in</BUTTON><BUTTON id='signout' class='suptabde' STYLE='text-align:center' VALUE='  Skype Login  '>Log out</BUTTON>
</TABLE>

我从 msdn 网站上复制了一份 js 内容,如下所示,

$(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');
        });
});
});

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

4

1 回答 1

1

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

于 2015-09-17T16:18:56.280 回答