Facebook在Facebook上邀请朋友的Facebook设置

时间:2013-10-10 10:50:12

标签: ios facebook facebook-graph-api

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

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

我已完成所有代码邀请朋友。

当我替换邀请朋友正在使用的示例代码的Facebook APP ID时,我的代码也正常工作。

但是当我替换我的APP ID时,过程进展顺利,向我显示成功的邀请消息,但不会发送邀请。

我使用以下代码:

[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] 

1 个答案:

答案 0 :(得分:0)

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