English 中文(简体)
B. 收受费
原标题:Recursive Facebook API Call
  • 时间:2012-04-09 12:21:22
  •  标签:
  • facebook

基本上,这是我想要做的事。

- Get all my likes (page likes)
- Get all my friends
- for each of my friends, get their likes
- for each of their likes, do something

现在,我这样做的方式是利用共同财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产或财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、 我的发言就是这样:

var newArray = [];
FB.api( me/likes , function(response){
   FB.api( me/friends , function(friends){
       $(friends).each(function(){
           FB.api(this.uid+ /likes , function(fr_likes){
             $(fr_likes).each(function(){
               //save this friend likes to newArray
               newArray.push(this);
             });
           });
       });
   });
});

//call newArray outside FB scope doesn t work at first
console.log(newArray);  //returns [] / empty

但是,如果我用黄色灯在一度之后打电话给新的阿雷,新阿雷拉则慢慢地用了联邦调查局的数据。

因此,我的问题是:

  1. Can I wait for all the FB.api calls to be complete before doing something outside FB scope?
  2. What is the best practice for doing something like that (recursive FB api calls)?

感谢答案

问题回答

You should read up on the Batch API. It allows you to make multiple requests in one single round-trip to Facebook s servers. Should speed things up considerably.





相关问题
Facebook Connect login dialog not working

I am using Facebook Connect for iPhone and following the official instructions. I use the following code to display the login dialog: FBLoginDialog* dialog = [[[FBLoginDialog alloc] initWithSession:...

Facebook App Profile Tab is Empty ... No Content Displayed?

I can view my application via the http://apps.facebook.com/myapplication/ link and the content shows up correctly. I also added the application as a tab to a facebook page. However, when viewing the ...

Facebook Platform error: "Object cannot be liked"

I m working on a Facebook Application that generates wall posts. In testing these posts, I ve discovered that the Facebook Platform action of "liking" a post is failing. The specific error message ...

how to call showPermissionsDialog() in php (facebook api)?

I was reading over the documentation yet I could not figure out how to call Facebook.showPermissionsDialog() in php include_once ./facebook-platform/php/facebook.php ; $facebook = new Facebook(my ...

Facebook connect

If I plug in the facebook connect into my website, How can I prevent double signups? Lets say I have a user that s already signed up to my site but he clicked the connect with facebook, is there a ...

热门标签