开发者

facebook apprequests dialog error "An error occurred. Please try again later."

开发者 https://www.devze.com 2023-03-13 12:31 出处:网络
I am trying to build-in \'invite a friend\' in my app. I am using FB.ui. It seems to work (I am using standard code from http://developers.facebook.com/blog/post/464/.

I am trying to build-in 'invite a friend' in my app. I am using FB.ui. It seems to work (I am using standard code from http://developers.facebook.com/blog/post/464/.

But the iframe where you should be able to send a request to your friends just says: "An error occurred. Please try again later."

I didn't forget to use access token.

echo '<div id="fb-root"></div>';
echo '<script src="http://connect.facebook.net/en_US/all.js">';
e开发者_如何学Ccho '  </script>';
echo '  <script>';
echo "    FB.init({appId:'215089721847404', cookie:true, status:true, xfbml:true});";

echo "    FB.ui({ method: 'apprequests', message: 'Here is a new Requests dialog...', display: 'iframe', access_token: '$token'});";
echo '  </script>';

Did fb stop allowing request dialogs from within apps? Or am I doing something wrong? Does someone have another solution? Please help.

Update: Maybe that is because I didn't put redirect_uri. Now I did and it doesn't give the error, but now the iframe just doesn't stop loading... Does anyone have an idea?


Request 2.0 are tricky, all parts have to be exactly as facebook wants it, or it will not work.

see http://af-design.com/blog/2011/02/17/using-facebook-requests-to-promote-a-website/ for a good example on how to do it.


I was having the same problem with several different calls the the apprequests method of the Facebook API, but intermittently.

In the end I found that the problem was being caused by calling the FB.ui function in inline javascript like you do. It would work fine sometimes, but on a slow network I always got the same error.

I fixed it by simply putting the FB.ui call within a function and using setTimeout call to trigger it after the page has completely loaded, like this

    function callAppReq() {
        FB.ui({ method: 'apprequests', 
                title: 'My Title', 
                message: 'Here is a new Requests dialog...'},
             function(response) {
             }
        );
    }
    var t=setTimeout("callAppReq()",3000);


One more possible catch is that facebook will not let you send app requests till you have configured your app domain.. Without mentioning app domain FB shall give you "An error occurred. Please try again later facebook apprequest error" consistently

Settings >> Basic Info >> App Domains

0

精彩评论

暂无评论...
验证码 换一张
取 消