不知道這是否會有所幫助,但這裏是我如何處理它。
的Javascript:
function sendRequest() {
FB.ui({
display: 'iframe',
method: 'apprequests',
title: 'Invite friends to join you',
message: 'Come play with me.'
},
function (res) {
if (res && res.request_ids) {
var requests = res.request_ids.join(',');
$.post('FBRequest.ashx',
{ request_ids: requests },
function (resp) { });
}
});
return false;
}
服務器端(FBRequest.ashx):
// get operation and data
var ids = HttpContext.Current.Request["request_ids"];
// if we have data
if(ids != null) {
// make batch graph request for request details
var requestIds = ids.Split(',').Select(i => long.Parse(i)).ToList();
var fbApp = new FacebookWebClient([AppId],[AppSecret]);
dynamic parameters = new ExpandoObject();
parameters.ids = ids;
dynamic requests = fbApp.Get(parameters);
// cycle through graph results and do stuff
dynamic req = null;
for(int i=0;i<requestIds.Count;i++) {
try {
req = requests[requestIds[i].ToString()];
// do stuff with request, save to DB, etc.
} catch (Exception ex) {
// error in finding request, continue...
}
}
}
你可以發佈你正在做的確切的調用和你得到的輸出嗎? – 2011-02-26 19:24:24
'GET/RequestID /'是具有權限'read_requests'或'user_about_me'返回false的圖形API調用,而不是請求對象。 – ak7 2011-02-28 14:38:45
任何使用目標用戶的提示可能是什麼?我們不知道他們在登錄時是誰的朋友,我們可以驗證他們的朋友列表與現有用戶fbids嗎? – Kevin 2012-08-26 01:41:06