使用库5.4.1进行FQL查询时出错 [英] Error with FQL query with library 5.4.1
问题描述
几个月前,我开发了一个应用程序来检索我的见解Facebook页面的计数器. 此应用程序可与库"Facebook C#SDK" 5.0.40版完美配合. 现在,我想使用最新的库版本5.4.1,但是我的应用程序不再起作用. 我不明白为什么.
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.
我使用以下代码:
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 });
例如,如果我请求相同的Facebook页面ID,相同的计数器,同一天,同一时间段
For example, if I make a request for the same facebook page Id, same counter, same day, same period
对于库5.0.40,我收到响应(计数器"page_fans"的示例:
with library 5.0.40, i receive a response (Example for counter "page_fans":
[{"name":"query0","fql_result_set":[{"metric":"page_fans","value":"12018"}]}]
对于库5.4.1,对于任何请求(任何计数器,任何一天,任何页面),我总是收到空响应:
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":[]}]
任何人都可以帮助我,并告诉我我需要在代码中进行哪些更改,以使我的应用程序可以使用"Facebook C#SDK"库的最新版本运行.
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.
最诚挚的问候
基督徒
推荐答案
作为临时解决方案,在修复此错误之前,您可以在end_time
中使用秒值,并且使用"寿命,天,周,days_28之一,月份" 表示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" for period
...
这篇关于使用库5.4.1进行FQL查询时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!