繁体   English   中英

Facebook FBWebDialogs参数一次邀请多个朋友

[英]Facebook FBWebDialogs params invite multiple friends at once

我在FB文档上找不到任何内容,但是基本上我正在寻找的功能是能够向FBWebDialogs的Params中添加多个FacebookId。 这是我正在尝试的示例,但当然不正确:

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

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

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM