适用于.NET的Facebook SDK的“登录按钮控件"示例未显示GraphUser对象 [英] 'LoginButton Control' sample for Facebook SDK for .NET do not show GraphUser objects

查看:91
本文介绍了适用于.NET的Facebook SDK的“登录按钮控件"示例未显示GraphUser对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试学习使用适用于.NET的Facebook SDK.专门用于Windows Phone 8.1通用应用程序(不是Silverlight).为此,我构建了"LoginButton控件"示例,可以在这里找到: http ://facebooksdk.net/docs/windows/controls/login-ui-control/ 我已成功使用示例登录到Facebook,但是显示了名称"较新的内容.它与这段代码有关:

I am trying to learn using the Facebook SDK for .NET. Specifically for Windows Phone 8.1 Universal App (not Silverlight). For this I have build the 'LoginButton Control' sample that can be found here: http://facebooksdk.net/docs/windows/controls/login-ui-control/ I have sucessfully logged in to Facebook with the sample, but the 'Name' newer shows up. It is related to this part of the code:

        <!--user information-->
        <StackPanel HorizontalAlignment="Right">
            <TextBlock 
                HorizontalAlignment="Center"
                Text="{Binding CurrentUser.Name, ElementName=loginButton}" />
        </StackPanel>

似乎'CurrentUser.x'无法检索ID,Name等其他数据.为进行进一步测试,我添加了'ProfilePicture Control'示例.事实证明,个人资料图片显示良好,但是无法显示所有其他GraphUser对象.

It seems that 'CurrentUser.x' is not able to retrieve other data like ID, Name etc. For further testing, I added the 'ProfilePicture Control' sample. It turns out that the profile picture shows fine, but all other GraphUser objects cannot be shown.

我正在使用Visual Studio 2013,Facebook 6.8.0,Facebook.Client 1.0.2.

I am using Visual Studio 2013, Facebook 6.8.0, Facebook.Client 1.0.2.

有人解释为什么该示例不提供对GraphUser对象的访问权吗?

Does anyone have an explanation for why this sample do not give access to GraphUser objects?

最诚挚的问候

推荐答案

您并不孤单!我遇到了同样的问题,但是花了6个小时后还是设法解决了. Nuget Facebook SDK的文档似乎已过时且未正确编写. 答案对我有很大帮助

You are not alone!! I had the same problem you had but however I managed to get it done after spending 6 hours. The documentation of Nuget Facebook SDK seems outdated and not properly written. This Answer helped me a lot.

这是我使用的Xaml.

Here is the Xaml I used.`

<TextBlock x:Name="Ganesh" Grid.Row="0" 
    FontSize="72" 
    HorizontalAlignment="Center" 
    VerticalAlignment="Center" 
    Text="Welcome" 
    Foreground="Red"
    Visibility="Collapsed"/>

<facebookControls:LoginButton 
    x:Name="loginButton" 
    Grid.Row="2" 
    HorizontalAlignment="Center" 
    VerticalAlignment="Center" 
    SessionStateChanged="loginButton_SessionStateChanged"/>

<facebookControls:ProfilePicture 
    x:Name="profilePicture"
    Width="50" 
    Height="50" 
    VerticalAlignment="Center"
    HorizontalAlignment="Center"
    CropMode="Original" 
    Grid.Row="3"/>

<TextBlock x:Name="userInfo"
    VerticalAlignment="Center"
    HorizontalAlignment="Center"
    TextWrapping="Wrap"
    Text=""
    FontSize="20"
    Grid.Row="1" 
    Foreground="#FF8B2020"
    Visibility="Collapsed"/>

`

这是Xaml.Cs

And here is the Xaml.Cs

包括所有必需的名称空间. 这段代码编写得不太整齐.这是为了测试.谢谢.

Include all necessary namespaces. This code was not neatly written. It was for test. Thanks.

这篇关于适用于.NET的Facebook SDK的“登录按钮控件"示例未显示GraphUser对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆