HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – 我在自定义表视图中有FB好友图片和名字.如何获取FB ID中的选定行并向多个朋友发送请求?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我有单个FB ID,它不能进行多项选择.我有自定义表视图
在FB好友列表中.如何获取选定的行FB ID

NSMutableArray *arryOfFBIds;
for (id<FBGraphUser> user in self.friendPickerController.SELEction) {

    NSMutableArray *SELEction=(NSMutableArray *) self.friendPickerController.SELEction;
     [SELEction addObject:user.id];


    arryOfFBIds = [[NSMutableArray alloc] init];
    for (id<FBGraphUser> user in self.friendPickerController.SELEction)
    {
        [arryOfFBIds addObject:user.id ];





                NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject: arryOfFBIds forKey: @"SELEctedFBIds"];
    [defaults synchronize];
        NSLog(@"array of fb id:%@",arryOfFBIds);
    }}




NSMutableDictionary* params2 =   [NSMutableDictionary DictionaryWithObjectsAndKeys:@"Invite to on Ensmbl",@"description",@"http://placebogames.com/",@"link",// 3. Suggest friends the user may want to request,Could be game context specific?
                                 [arryOfFBIds componentsJoinedByString:@","],@"to",nil];
NSLog(@"qwer:%@",params2);



[FBWebDialogs presentFeedDialogModallyWithSession:[FBSession activeSession] parameters:params2  handler:^(FBWebDialogResult result,NSURL *resultURL,NSError *error)
{
     NSLog(@"error===>%@,resultURL===>%@",error,resultURL);
 } ];


}

解决方法

查看下载的SDK源文件(可能安装在My Documents文件夹中) – 其中一个示例源代码称为FriendPickerSample.xcodeproj

简而言之,为了显示朋友的表格视图,FB iOS使用一个名为FPViewController的特殊自定义tableview控制器类,它继承自UIViewController但具有allowsMultipleSELEction属性,如果设置为TRUE,则允许您选择几个朋友,直到您按下完成按钮.

完成按钮将触发一个名为的委托方法

- (void)facebookViewControllerDoneWasPressed:(id)sender {
   NSMutableString *text = [[NSMutableString alloc] init];

   // we pick up the users from the SELEction,and create a String that we use to     update the text view
   // at the bottom of the display; note that self.SELEction is a property inherited     from our base class
   for (id<FBGraphUser> user in self.friendPickerController.SELEction) {
        if ([text length]) {
           [text appendString:@","];
       }
      [text appendString:user.name];
   }

    [self fillTextBoxAndDismiss:text.length > 0 ? text : @"<None>"];     
}

只需使用示例代码并进行修改,即可为所选朋友群做任何您想做的事情.

大佬总结

以上是大佬教程为你收集整理的ios – 我在自定义表视图中有FB好友图片和名字.如何获取FB ID中的选定行并向多个朋友发送请求?全部内容,希望文章能够帮你解决ios – 我在自定义表视图中有FB好友图片和名字.如何获取FB ID中的选定行并向多个朋友发送请求?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。