javascriptfacebookfacebook-graph-apifacebook-appsfacebook-invite-friends

The Facebook game invite is not triggering the callback


I'm using the Facebook API SDK for JavaScript to invite the authenticated user's friends to use the app.

To invite the friends, I use the Invitable Friends API, like this:

FB.ui({
   method: 'apprequests',
   message: "Hey, use my app!"
}, function(){
   debugger
});

Before that I initialize the Facebook API on the page using FB.init:

$.getScript("https://connect.facebook.net/en_us/sdk.js", function ()  {
  FB.init({
      appId: "14....56",
      version: "v2.5"
  });
});

The invite friends popup is working fine, but when clicking the Done button (in the popup), the callback function is not called (and the debugger is not reached).

However, if I click the window close button (to close the popup), the function is called.

How to fix the code to call the callback when clicking the Done button as well?


Solution

  • I think this was something temporal, most probably related to OP's local environment.

    I was not able to reproduce this locally. The guys from Facebook developers couldn't reproduce it as well.

    After one day, when debugging this with Nuvi (the question OP), the problem didn't appear again. I speculate this was strongly related to some temporal Chrome/developer tools problem.