1

我想向朋友发送 Facebook 邀请,但我不知道为什么在接收端显示邀请。

我用了这段代码

NSMutableDictionary* params = 
          [NSMutableDictionary dictionaryWithObjectsAndKeys:nil];
[FBWebDialogs 
    presentRequestsDialogModallyWithSession:nil                                              
    message:[NSString stringWithFormat:
                         @"I just smashed friends! %d Can you beat it?",15]
    title:@"MSR"
    parameters:params                                                        
    handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
              if (error) {
                 // Case A: Error launching the dialog or sending request.
                 NSLog(@"Error sending request.");
              } else {
                 if (result == FBWebDialogResultDialogNotCompleted) {
                     // Case B: User clicked the "x" icon
                     NSLog(@"User canceled request.");
                  } else {
                     NSLog(@"Request Sent.");
                  }
    }}];

谁能帮我??

4

1 回答 1

0

只是一个猜测->我在我的应用程序中使用了此代码,但它运行良好。你可以试试这个。

[FBWebDialogs presentRequestsDialogModallyWithSession:nil
                                              message:@"Please come and try Thot Of U!"
                                                title:@"Invite a Friend"
                                           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 {
                                                              // Handle the send request callback
                                                              NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
                                                              if (![urlParams valueForKey:@"request"]) {
                                                                  // User clicked the Cancel button
                                                                  NSLog(@"User canceled request.");
                                                              } else {
                                                                  // User clicked the Send button
                                                                  NSString *requestID = [urlParams valueForKey:@"request"];
                                                                  NSLog(@"Request ID: %@", requestID);
                                                              }
                                                          }
                                                      }
                                                  }];
于 2013-08-23T06:15:11.487 回答