FB.ui correlation does not give a callback

I cannot get a response from my Facebook FB.UI () method. I am convinced that I am using it correctly, since the actual message is being sent to my wall, but the callback data is either missing or empty. I use:

FB.ui({ method: 'feed', name: 'asd', link: 'asd', picture: '', description: 'asd' }, function(response) { console.log(response); if(response.post_id) { $.post("ajax/wall.php",{wall : 1}); } else { } } ); 
+4
source share
6 answers

I'm not sure how this was resolved , but he did :)

I cleared my cache and changed my code below and it worked (however, I do not believe that changing the code actually affected it:

 FB.ui({method: 'feed',name: '',link: '',picture: '',description: 'asd'}, function(data) { console.log(response); if(data && data.post_id) { $.post("ajax/wall.php",{wall : 1}); } else { alert("not sent"); } }); 
+3
source

I have the same problem and I could never get a response from Facebook for the callback function. I do not see anything in console.log or any warnings that I insert in this function.

My solution was to put the URL in FB.ui redirect_uri, which is sent to the HTML page with self.close (or window.close). The FB.ui popup window is redirected there after user input and closes immediately. Remember to change the URL setting of your FB application to match the domain where the file is located.

Here, my code attached to my form represents an action. The function (response) callback is still present but not used. If someone sees a syntax error, comment on it.

  FB.ui ({ method: 'feed', name: '', link: '', picture: '', caption: '', description: '', actions: {name:'',link:''}, redirect_uri: 'http://.../self.close.html' }, function(response) { console.log(response); if (response && response.post_id) { alert('yes'); self.close(); } else { alert('else yes'); } }); 

Line of code in self.close.html:

 <script type="text/javascript">self.close();</script> 
+2
source

Remove the redirect_uri element and the call will start.

I ran into the same question a few minutes ago and realized that removing redirect_uri solved it.

+2
source

For those who encounter this problem later, I had the same problem and fixed it like this:

 <div class="post-view-backdrop hide" id='post-view-backdrop'> <div id="fb-root"></div> 

has become

 <div class="post-view-backdrop hide" id='post-view-backdrop'></div> <div id="fb-root"></div> 

The post-view-backdrop distributor should never contain fb-root, I just skipped the close tag.

The problem was incorrectly formed HTML around my fb-root. I just found this to guess the specific reason for using the html validator.

+2
source

For those on Phonegap dealing with this issue, the problem is with the fb connect plugin. It just doesn't trigger callbacks.

Here is the code snippet from FacebookConnectPlugin.m:

 //////////////////////////////////////////////////////////////////// // FBDialogDelegate /** * Called when the dialog succeeds and is about to be dismissed. */ - (void)dialogDidComplete:(FBDialog *)dialog { // TODO } /** * Called when the dialog succeeds with a returning url. */ - (void)dialogCompleteWithUrl:(NSURL *)url { // TODO } /** * Called when the dialog get canceled by the user. */ - (void)dialogDidNotCompleteWithUrl:(NSURL *)url { // TODO } /** * Called when the dialog is cancelled and is about to be dismissed. */ - (void)dialogDidNotComplete:(FBDialog *)dialog { // TODO } 

I am not an Objective-C programmer, so I am not trying to solve this problem, I may have to wait for the plugin to finish ...

+1
source

setting redirect_uri disables callback

+1
source

Source: https://habr.com/ru/post/1381705/


All Articles