1

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

我们需要在应用程序中(在 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] 
4

1 回答 1

0

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

于 2014-10-07T05:52:30.340 回答