[英]Live SDK for windows phone 8
Hay there, I'm learning the live SDK fro windows phone 8 & I'm using Live SDK 5.5. 干草,我正在学习Windows Phone 8的实时SDK,而我正在使用Live SDK 5.5。 I have downloaded the SDK, installed it and referenced it in my project I also have created a key for my application and I followed the exact code in here and that's my code: XAML
我已经下载了SDK,在项目中安装并引用了该SDK,还为我的应用程序创建了一个密钥,然后按照此处的确切代码进行操作,这就是我的代码: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>
and that's my C# code 那就是我的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.";
}
}
But the application doesn't show me the login page so that I enter my user name and password for my live account it just loads and then it says " not signed in" in the text box. 但是该应用程序不会显示登录页面,因此我只输入我的真实帐户的用户名和密码,然后才在文本框中显示“未登录”。
As it turned out after checking comments adding wl.skydrive
to Scopes property solved the issue: 事实证明,检查注释
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"/>
More about available scopes you can read here at MSDN . 有关可用范围的更多信息, 可以在MSDN上阅读 。
Also your App should me marked as for mobile devices at your account . 另外, 您的帐户应将我的应用标记为移动设备 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.