0
我試圖獲得來自Facebook好友列表,然後更改數值解析用戶ID是這樣的:parse.com CLOAD代碼HTTP請求和查詢
我從Facebook好友名單中,我嘗試獲取任何已安裝項目的項目。
然後,我嘗試通過查詢FB id來解析用戶標識來替換install:true,並將其存儲在parse .com(應用安裝時)中。問題是,解析不返回任何值沒有錯誤/成功味精沒有任何東西。
Parse.Cloud.define("fbtomo3", function(request, response)
{
var fbid =request.user.get('FaceBookId');
var fbtoken = request.user.get('authData').facebook.access_token;
var listFromFB ="";
Parse.Cloud.httpRequest(
{
url:"https://graph.facebook.com/"+fbid+"?fields=friends.fields(installed,name)&access_token="+fbtoken+'"',
success:function(httpResponse)
{
listFromFB = JSON.parse(JSON.stringify(httpResponse.data.friends.data));
console.log("GOT FBLIST");
for(var item in listFromFB)
{
if(listFromFB[item].installed!=null)
{
var query = new Parse.Query("User");
query.notEqualTo("FaceBookId",listFromFB[item].id);
query.find({
success: function(results)
{
console.log(results.id);
//this is where i change listFromFB[item].installed to user id but i dint get any results from query
//response.success(results);
},
error: function(error) {
//response.error("failed to look for users");
console.log(error.code);
}
});
}
}
response.success(listFromFB);
},
error:function(httpResponse)
{
console.log("didnt get it");
response.error(httpResponse);
}});
});
該查詢似乎不起作用。任何人都可以幫我解決問題嗎?
我應該注意,查詢本身的工作,如果得到它在另一個雲碼定義函數。