我正在尝试查看名为CS-Canvas-AspNetWebForms-WithoutJsSdk的C#Facebook SDK的示例代码,我收到以下错误:
'Facebook.JsonObject' does not contain a definition for 'id'
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'Facebook.JsonObject' does not contain a definition for 'id'
Source Error:
Line 30: dynamic me = fb.Get("me");
Line 31:
Line 32: imgProfilePic.ImageUrl = string.Format("https://graph.facebook.com/{0}/picture", me.id);
Line 33:
Line 34: lblName.Text = me.name;
Source File: C:\Users\Jessee\Downloads\facebooksdk-71da22b901ac\facebooksdk_71da22b901ac\Samples\CS-Canvas-AspNetWebForms-WithoutJsSdk\Facebook\Default.aspx.cs Line: 32
答案 0 :(得分:0)
我们(Facebook)不提供.NET SDK,但基于此错误,它看起来像JSON反序列化器或属性访问器正在寻找不存在的id字段/属性。我的猜测是网络呼叫没有完成(我们在/ me结果中包含'id'字段)。我会打开HTTP跟踪,看看呼叫是否正在完成。