【问题标题】:Live SDK for windows phone 8适用于 windows phone 8 的实时 SDK
【发布时间】:2019-01-23 16:13:27
【问题描述】:

嘿,我正在学习 Windows Phone 8 的实时 SDK,我正在使用 Live SDK 5.5。 我已经下载了 SDK,安装了它并在我的项目中引用了它 我还为我的应用程序创建了一个密钥,并遵循here 中的确切代码 这就是我的代码: XAML

    <live:SignInButton ClientId="my ID" x:Name="btnSignin" Scopes="wl.signin wl.basic" Branding="Skydrive" SessionChanged="btnSignin_SessionChanged" Margin="10,0,-10,194" Height="104" VerticalAlignment="Bottom"  />
    <TextBlock Height="102" Foreground="White" HorizontalAlignment="Left" Margin="26,128,0,0" Name="infoTextBlock" VerticalAlignment="Top" Width="419" />
</Grid>

这是我的 C# 代码

    private async void btnSignin_SessionChanged(object sender, LiveConnectSessionChangedEventArgs e)
    {
        if (e.Status == LiveConnectSessionStatus.Connected)
        {
            client = new LiveConnectClient(e.Session);
            LiveOperationResult operationResult = await client.GetAsync("me");
            try
            {
                dynamic meResult = operationResult.Result;
                if (meResult.first_name != null &&
                    meResult.last_name != null)
                {
                    infoTextBlock.Text = "Hello " +
                        meResult.first_name + " " +
                        meResult.last_name + "!";
                }
                else
                {
                    infoTextBlock.Text = "Hello, signed-in user!";
                }
            }
            catch (LiveConnectException exception)
            {
                this.infoTextBlock.Text = "Error calling API: " +
                    exception.Message;
            }
        }
        else
        {
            infoTextBlock.Text = "Not signed in.";
        }
    }

但是应用程序没有显示登录页面,因此我输入了我的用户名和密码,它只是加载了我的真实帐户,然后在文本框中显示“未登录”。

【问题讨论】:

  • 您是否尝试将 wl.skydrive 添加到 Scopes:Scopes="wl.signin wl.skydrive wl.basic"?并检查您是否已将您的应用程序标记为手机(您已在此处注册并获得 ID)。
  • 谢谢它的工作:)

标签: c# windows-phone-8 onedrive live-sdk


【解决方案1】:

在检查 cmets 后发现,将 wl.skydrive 添加到 Scopes 属性解决了这个问题:

<live:SignInButton ClientId="my ID" x:Name="btnSignin" Scopes="wl.signin wl.basic wl.skydrive" 
 Branding="Skydrive" SessionChanged="btnSignin_SessionChanged" Margin="10,0,-10,194"
 Height="104" VerticalAlignment="Bottom"/>

更多关于你can read here at MSDN的可用范围。

我也应该将您的应用标记为用于移动设备your account

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-11-30
    • 1970-01-01
    • 1970-01-01
    • 2016-06-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多