建立Facebook IOS朋友多选择器

时间:2014-09-06 10:58:50

标签: ios facebook

我想构建一个朋友多选择器,以便我的用户可以向他的任何朋友发送请求。我知道有FBfriendselectorcontroller,但它没有选择所有朋友的选项,我想在我的应用程序中拥有它。我尝试通过以这种方式获取好友列表来手动填充UITableview:

权限(使用登录按钮登录):

NSArray *permissions = [[NSArray alloc] initWithObjects:@"public_profile", @"email", @"user_friends", nil];
self.loginView.readPermissions = permissions;

数据:

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

                              //NSArray *data = [result objectForKey:@"data"];

                              NSLog(@"%@", result);

                              NSMutableDictionary* params =   [NSMutableDictionary dictionaryWithObjectsAndKeys: [NSString stringWithFormat:@"%@", result], @"to", @"send", @"action_type", @"YOUR_OBJECT_ID", @"object_id", nil];

                              [FBWebDialogs
                               presentRequestsDialogModallyWithSession:nil
                               message:@"Take this bomb to blast your way to victory!"
                               title:nil
                               parameters:params
                               handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {}
                               ];

                          }];

朋友计数返回318,但“数据”是这样的:()。我也试过了:

FBRequest* friendsRequest = [FBRequest requestForMyFriends];
    [friendsRequest startWithCompletionHandler: ^(FBRequestConnection *connection,
                                                  NSDictionary* result,
                                                  NSError *error){

        NSArray* friends = [result objectForKey:@"data"];

但数据为空。我做错了什么?!!

0 个答案:

没有答案