ios – 我在自定义表视图中有FB好友图片和名字.如何获取FB ID中的选定行并向多个朋友发送请求?

ios – 我在自定义表视图中有FB好友图片和名字.如何获取FB ID中的选定行并向多个朋友发送请求?,第1张

概述我有单个FB ID,它不能进行多项选择.我有自定义视图 在FB好友列表中.如何获取选定的行FB ID NSMutableArray *arryOfFBIds;for (id<FBGraphUser> user in self.friendPickerController.selection) { NSMutableArray *selection=(NSMutableArray *) 我有单个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中的选定行并向多个朋友发送请求?所遇到的程序开发问题。

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

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1022175.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存