2014-04-01 55 views
0

干草在那里我正在学习Windows SDK的Live SDK 8 &我使用Live SDK 5.5 我已经下载了SDK,安装了它并在我的项目中引用了它 我也创建了我的应用程序和我一个键,然后在here 确切的代码,这就是我的代码 XAML 用于Windows Phone 8的Live SDK

<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."; 
     } 
    } 

但应用程序不会显示我的登录页面,以便我输入我的用户名和密码为我的真实帐户它只是加载,然后它在文本框中显示“未登录”

+0

您是否尝试将wl.skydrive添加到作用域:'Scopes =“wl.signin wl.skydrive wl.basic”'?还要检查您是否将手机标记为您的应用程序(在那里您已经注册并获得了ID)。 – Romasz

+0

感谢他的工作:) – a3adel

回答

0

事实证明检查留言中加入wl.skydrive到作用域属性后,解决了这个问题:

<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