我想知道如何从 Android 应用向我所有的 Facebook 好友发送应用请求。我在图形 API 中尝试过。但是,无法完成。
https://graph.facebook.com/apprequests?ids=friend1,friend2&message='Hi'&method=post&access_token=ACCESS_TOKEN
我知道这是一个重复的问题。但是,还没有找到答案。 我在上述 API 上收到此错误。
"All users in param ids must have accepted TOS."
我希望有一种方法可以通过点击向手机上的所有 friend 发送应用请求。请分享。
最佳答案
您收到的错误消息(“参数 ID 中的所有用户必须接受 TOS”)是因为您正试图将应用生成的请求发送给未连接到您的应用的用户。
参见 developer docs here .
通过请求对话框发送的请求和应用生成的请求是不同的,您不能使用应用生成的请求来邀请用户使用您的应用。
无法通过图形 API 发送 Facebook 应用程序请求。您可以使用 app requests java-script dialog但是要发送请求,您只需要在文档中详述的“to”属性中指定用户的 ID。
示例函数:
<script>
FB.init({ appId: '**appId**', status: true, cookie: true, xfbml : true });
function sendRequest(to) {
FB.ui({method: 'apprequests', to: to, message: 'You should learn more about this awesome site.', data: 'tracking information for the user'});
return false;
}
</script>
然后只需将每个图像的 onclick 连接到 onclick="return sendRequest('**friendId**');"
你也可以在javascript中调用这个函数:它会给你所有的 friend 照片。还有一组目前正在使用相同应用程序的 friend 。您可以向其中任何一个发送请求。
function sendRequestViaMultiFriendSelector() {
FB.ui({
method: 'apprequests',
message: "You should learn more about this awesome site."
});
}
参见 Facebook Friend Request - Error - 'All users in param ids must have accepted TOS'
关于android - 在 Android 中使用 'Requests Dialog' 向 Facebook 中的所有好友发送 App 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14358773/