列出iOS中本机邀请对话框中的所有Facebook好友

时间:2015-01-02 08:34:27

标签: ios objective-c iphone facebook facebook-graph-api

我正在尝试邀请ios中的facebook朋友。成功我也得到了输出。我也附加了输出图像。 enter image description here

我的问题是,在这里我可以看到建议的朋友列表,而不是显示我的所有朋友。但是当我在搜索栏中搜索任何朋友时,它会显示该搜索列表。我的代码是,

 NSString *MY_URL = [NSString stringWithFormat:@"xxxxxxxxxx://host"];
    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithCapacity:0];
    [params setObject:@"Hi, Check out this app, You'll love it!" forKey:@"message"];
    [params setObject:MY_URL forKey:@"link"];

    [FBWebDialogs presentRequestsDialogModallyWithSession:FBSession.activeSession
                                                  message:@"Friends Invite"
                                                    title:@"xxxxxxxx"
                                               parameters:params handler:
     ^(FBWebDialogResult result, NSURL *resultURL, NSError *error)
     {
         if (!error) {
             NSLog(@"Url : %@",resultURL);
             NSLog(@"Result : %u",result);
             NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
             if (![urlParams valueForKey:@"request"]) {
                 // User clicked the Cancel button
                 NSLog(@"User canceled request.");
             } else {
                 // User clicked the Send button
                 NSString *requestID = [urlParams valueForKey:@"request"];
                 NSLog(@"Request ID: %@", requestID);
             }
         }
         else
         {
             NSLog(@"Error : %@",[error localizedDescription]);
         }

     }];

我的观点是如何在此邀请列表中显示我的所有朋友。

1 个答案:

答案 0 :(得分:3)

对于2014年4月之后注册的Facebook Apps,除非您正在实施游戏/画布应用,否则无法访问所有朋友。 (如果是这种情况,则需要使用invitable_friends端点)

否则,不幸的是,您将只能访问已登录到您应用的Facebook好友。

注意:即使您的应用是在2014年4月之前创建的,2015年4月之后所有朋友都将无用。

For more info in facebook developer

New features available in v2.0 Taggable Friends API: We've added a new endpoint called /me/taggable_friends that you can use in order to generate stories that have friends tagged in them, even those friends don't use your app. If you want to use the taggable friends API, your app will require review. Invitable Friends API: We've added a new endpoint called /me/invitable_friends that you can use to generate a list of friends for someone to invite to your game through a custom interface. This API is only available to apps that are games on Facebook Canvas.