如何邀请Facebook好友进行应用请求通知?

时间:2014-06-30 11:23:50

标签: ios facebook facebook-graph-api friend invite

我有一个非游戏应用,我想通过发送通知邀请我的Facebook好友。 Facebook平台升级过去几个月,请查看this链接。

现在如何向朋友发送邀请?

我应该使用共享墙贴而不是邀请。

感谢。

2 个答案:

答案 0 :(得分:0)

您甚至可以立即发送邀请:

尝试此代码....

[FBWebDialogs
         presentRequestsDialogModallyWithSession:nil
         message:@"YOUR_MESSAGE_HERE"
         title:nil
         parameters:nil
         handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
             if (error) {
                 // Error launching the dialog or sending the request.
                 NSLog(@"Error sending request.");
             } else {
                 if (result == FBWebDialogResultDialogNotCompleted) {
                     // User clicked the "x" icon
                     NSLog(@"User canceled request.");
                 } else {
                    NSLog(@"Request Sent.");
                        }
             }
         }];

希望这会对你有所帮助。

答案 1 :(得分:0)

使用此代码可以邀请您 facebook脚本部分。

Link

<script>
document.getElementById("apprequest").onclick =  function(){

FB.ui({method: 'apprequests',
      message: 'YOUR_MESSAGE_HERE'
    }, function(response){
        alert("Success");
  //console.log(response);
    });

}
</script>

HTML部分

<body>

<div id="fb-root">

<button id="apprequest" name="btnLogin" >App Request</button>

</div>