使用库 5.4.1 进行 FQL 查询时出错
几个月前,我开发了一个应用程序来检索我的见解 Facebook 页面的计数器。 该应用程序与库“Facebook C# SDK”版本 5.0.40 完美配合。 现在我想使用最新的库版本 5.4.1,但我的应用程序不再工作。 我不明白为什么。
我使用以下代码:
var fb = new FacebookClient(m_accessToken);
fb.GetCompleted +=
(o, e) =>
{
if (e.Error == null)
{
dynamic result = e.GetResultData();
// e.UserState contains the 'p_date' object which caracterize the Query
string response = result.ToString();
Console.WriteLine(response);
}
};
var query0 = string.Format("SELECT metric, value FROM insights WHERE object_id=" + p_pageId + " AND metric='" + p_counter + "' AND end_time=end_time_date('" + p_date + "') AND period=period('" + p_period + "')");
fb.QueryAsync(new[] { query0 });
例如,如果我
对库 5.0.40 的相同 Facebook 页面 ID、相同计数器、同一天、同一时期发出请求,我会收到响应(计数器“page_fans”示例:
[{"name":"query0","fql_result_set":[{"metric":"page_fans","value":"12018"}]}]
使用库 5.4 .1,对于任何请求(任何计数器、任何一天、任何页面),我总是收到空响应:
[{"name":"query0","fql_result_set":[]}]
有谁可以帮助我并告诉我需要在代码中更改哪些内容,以允许我的应用程序与最新版本的“ Facebook C# SDK”库。
最好的问候
Christian
A few months ago I developed an application to retrieve the counters of my insights Facebook pages.
This application works perfectly with the library "Facebook C# SDK" version 5.0.40.
Now I want to use the last library version 5.4.1 but my application no longer works.
I do not understand why.
I use the following code :
var fb = new FacebookClient(m_accessToken);
fb.GetCompleted +=
(o, e) =>
{
if (e.Error == null)
{
dynamic result = e.GetResultData();
// e.UserState contains the 'p_date' object which caracterize the Query
string response = result.ToString();
Console.WriteLine(response);
}
};
var query0 = string.Format("SELECT metric, value FROM insights WHERE object_id=" + p_pageId + " AND metric='" + p_counter + "' AND end_time=end_time_date('" + p_date + "') AND period=period('" + p_period + "')");
fb.QueryAsync(new[] { query0 });
For example, if I make a request for the same facebook page Id, same counter, same day, same period
with library 5.0.40, i receive a response (Example for counter "page_fans":
[{"name":"query0","fql_result_set":[{"metric":"page_fans","value":"12018"}]}]
with library 5.4.1, I receive always an empty response for any request (any counter, any day, any page):
[{"name":"query0","fql_result_set":[]}]
Does anyone can help me and tell me what I need to change in my code to allow my application runs with recent versions of the "Facebook C# SDK" library.
Best regards
Christian
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
作为此错误修复之前的临时解决方案,您可以使用以秒为单位的值来表示
end_time
,并使用 “lifetime, day, week, days_28, Month” 之一来表示period
...As a temporary solution until this bug is fixed you can use value in seconds for
end_time
and one of "lifetime, day, week, days_28, month" forperiod
...