2013-08-22 100 views
1

我想向Facebook好友發送Facebook邀請,但我不知道爲什麼會在接收端顯示邀請。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."); 
        } 
    }}]; 

任何一個能幫助我嗎?

回答

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); 
                   } 
                  } 
                 } 
                }];