Facebook设置为Facebook邀请朋友 [英] Facebook setting for Invite friend in Facebook

查看:170
本文介绍了Facebook设置为Facebook邀请朋友的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个容易的问题,但任何人都可以告诉我。

It may be an easy question but can anybody tell me.

有什么设置我们需要在应用程序(在Facebook开发者网站)做邀请的朋友?

Is there any setting we need to do in the app (in Facebook developer site) for invite friends?

我已经完成了所有的代码来邀请朋友。

I have done all in code to invite friends.

当我替换Facebook的APP请求朋友正在工作的示例代码,然后我的代码也可以正常工作。

When I substitute the Facebook APP ID of a sample code in which invite friend is working, then my code is also working fine.

但是当我替换我的APP ID时,该过程正常,显示我成功邀请消息,但邀请不发送。

But when I substitute my APP ID then the process is going fine, showing me successfully invitation message, but invitation is not sent.

我使用以下代码:

[FBWebDialogs presentRequestsDialogModallyWithSession:nil
                                              message:FacebookInviteMessage
                                                title:@"Invite Friends"
                                           parameters:parameters
                                              handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {

                                                  NSString *strResultUrl = [resultURL absoluteString];

                                                  if (result == FBWebDialogResultDialogCompleted && ![strResultUrl isEqualToString:@"fbconnect://success"])
                                                  {
                                                      MIDLog(@"Web dialog complete: %@", resultURL);

                                                      if (![resultURL query])
                                                      {
                                                          return;
                                                      }

                                                      NSDictionary *params = [self parseURLParams:[resultURL query]];
                                                      NSMutableArray *recipientIDs = [[NSMutableArray alloc] init];
                                                      for (NSString *paramKey in params)
                                                      {
                                                          if ([paramKey hasPrefix:@"to["])
                                                          {
                                                              [recipientIDs addObject:[params objectForKey:paramKey]];
                                                          }
                                                      }
                                                      if ([params objectForKey:@"request"])
                                                      {
                                                          NSLog(@"Request ID: %@", [params objectForKey:@"request"]);
                                                      }
                                                      if ([recipientIDs count] > 0)
                                                      {
                                                          //[self showMessage:@"Sent request successfully."];
                                                          //NSLog(@"Recipient ID(s): %@", recipientIDs);
                                                          UIAlertView *alrt = [[UIAlertView alloc] initWithTitle:@"Success!" message:@"Invitation(s) sent successfuly!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
                                                          [alrt show];
                                                          alrt = nil;
                                                      }





                                                      UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Success" message:FacebookInviteSuccess delegate:self cancelButtonTitle:@"Proceed" otherButtonTitles:nil];
                                                      alert.tag = 14114;
                                                      [alert show];
                                                      alert = nil;

                                                  }

                                                  else if (result == FBWebDialogResultDialogCompleted && [strResultUrl isEqualToString:@"fbconnect://success"])
                                                  {
                                                      MIDLog(@"Cancel Clicked");

                                                      UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Cancelled" message:nil delegate:self cancelButtonTitle:@"Proceed" otherButtonTitles:nil];
                                                      alert.tag = 14114;
                                                      [alert show];
                                                      alert = nil;

                                                  }

                                                  else {
                                                      MIDLog(@"Web dialog not complete, error: %@", error.description);

                                                      UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:InternetFailError delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
                                                      alert.tag = 15115;
                                                      [alert show];
                                                      alert = nil;

                                                  }
                                              }
                                          friendCache:self.friendCache] 


推荐答案

我在Facebook开发者网站的应用程序设置中提供了画布URL,它适用于我

I provided the canvas URL in the application settings under Facebook developer site and It works for me

这篇关于Facebook设置为Facebook邀请朋友的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆