2015-02-06 143 views
0

我正在使用此代碼,發送邀請朋友請求Facebook freinds,此代碼給出的消息是用戶取消的請求。發送Facebook朋友請求邀請返回消息:用戶取消請求

[FBRequestConnection startWithGraphPath:@"/me/friends" 
          parameters:nil 
          HTTPMethod:@"GET" 
         completionHandler:^(
              FBRequestConnection *connection, 
              id result, 
              NSError *error 
             ) { 


          // NSLog(@"%@", result); 
          NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: [NSString stringWithFormat:@"%@", result], @"to", @"send", @"action_type", @"YOUR_OBJECT_ID", @"object_id", nil]; 
          //for (NSDictionary *params in [result objectForKey:@"data"]) 
          { 
           [FBWebDialogs 
           presentRequestsDialogModallyWithSession:nil 
           message:@"Learn how to make your iOS apps social." 
           title:nil 
           parameters:params 
           handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) { 
            if (error) { 
             // Error launching the dialog or sending 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 = [appDelegate 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); 
              } 
             } 
            } 
           }]; 
         } 

         }]; 

回答

0

請通過只添加以下代碼,並刪除上面的代碼塊來檢查。

[FBWebDialogs 
    presentRequestsDialogModallyWithSession: nil 
    message:@"Your invite message" 
    title:nil 
    parameters:nil 
    handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) { 
              if (error) { 
               // An error occurred, we need to handle the error 
               // See: https://developers.facebook.com/docs/ios/errors 
               NSLog(@"Error publishing story: %@", error.description); 
              } else { 
               if (result == FBWebDialogResultDialogNotCompleted) { 
                // User canceled. 
                NSLog(@"User cancelled."); 
               } else { 
                // Handle the publish feed callback 




                } 

             } 


}]; 
+0

我想發送請求只有密友在facebook上.. – 2015-02-06 09:29:55

相關問題