Facebook邀请通知错误

时间:2013-08-22 15:28:08

标签: iphone ios facebook ios6

我想向朋友发送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.");
                  }
    }}];

任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分: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);
                                                              }
                                                          }
                                                      }
                                                  }];