Facebook FBWebDialogs params一次邀请多个朋友

时间:2013-10-28 18:33:00

标签: ios xcode facebook facebook-graph-api

我在FB文档上找不到任何关于此的内容,但基本上我正在寻找的是能够为FBWebDialogs添加多个FacebookId到Params中。这是我尝试的例子,但当然不对:

NSMutableDictionary* params =   [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                 facebookID1, @"to", 
                                 facebookID2, @"to",
                                 facebookID3, @"to",
                                 nil];

FBFrictionlessRecipientCache *friendCache = [[FBFrictionlessRecipientCache alloc] init];
[friendCache prefetchAndCacheForSession:nil];

[FBWebDialogs presentRequestsDialogModallyWithSession:nil
                                              message:[NSString stringWithFormat:@"هل سمعت باليومي؟ برنامج iPhone إخباري روعا"]
                                                title:nil
                                           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. %@", error);
                                                      }
                                                  }}
                                          friendCache:friendCache];

2 个答案:

答案 0 :(得分:1)

简单,将所有这些字符串放在一个数组中,然后params中的对象是字符串数组,键是@“to”。

答案 1 :(得分:1)

对于FBWebDialogs参数中的多个ID,您应将键设置为“至[0]”,“至[1]”,......“至[n]”:

NSMutableDictionary* params =   [NSMutableDictionary dictionaryWithObjectsAndKeys:
                             facebookID1, @"to[0]", 
                             facebookID2, @"to[1]",
                             facebookID3, @"to[2]",
                             nil];