【问题标题】:Invite Facebook friends through iPhone App using FBWebDialogs使用 FBWebDialogs 通过 iPhone 应用程序邀请 Facebook 朋友
【发布时间】:2014-06-21 18:35:24
【问题描述】:

我正在使用 Facebook sdk 3.10 使用 FBWebDialogs 一次向多个朋友发送请求。遵循我正在使用的代码,一切都很好,比如选择多个朋友,向他们发送请求。但是有一个问题,这个 FBWebDialogs 是否使用了一些朋友限制,因为我有超过 300 个朋友,但这总是只显示 12-15 个朋友。

代码

[FBWebDialogs
             presentRequestsDialogModallyWithSession:nil
             message:@"Learn how to make your iOS apps social."
             title:nil
             parameters:nil
             handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
                 if (error) {
                     // Error launching the dialog or sending the request.
                     NSLog(@"Error sending request.");
                 } else {
                     if (result == FBWebDialogResultDialogNotCompleted) {
                         // User clicked the "x" icon
                         NSLog(@"User canceled request.");
                     } else {
                         // Handle the send request callback
                         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);
                         }
                     }
                 }
             }];

使用上述方法我只能在对话框中看到最多 12 个朋友?我错过了什么吗?

任何帮助将不胜感激。

【问题讨论】:

  • 您找到解决方案了吗?我面临同样的问题,它适用于 20-30 个朋友,但除此之外,它会自动关闭带有 FBWebDialogResultDialogNotCompleted 结果的对话框!

标签: iphone facebook facebook-graph-api ios7


【解决方案1】:

您应该将NSDictionary 类型对象传递给参数参数。 你可以这样创建:

NSArray *suggestedFriends = [[NSArray alloc] initWithObjects:@"fb_id1", @"fb_id2", nil];

NSMutableDictionary* params =   [NSMutableDictionary dictionaryWithObjectsAndKeys:[suggestedFriends componentsJoinedByString:@","], @"suggestions", nil];

现在

[FBWebDialogs
             presentRequestsDialogModallyWithSession:nil
             message:@"Learn how to make your iOS apps social."
             title:nil
             parameters:params
             handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
                 if (error) {
                     // Error launching the dialog or sending the request.
                     NSLog(@"Error sending request.");
                 } else {
                     if (result == FBWebDialogResultDialogNotCompleted) {
                         // User clicked the "x" icon
                         NSLog(@"User canceled request.");
                     } else {
                         // Handle the send request callback
                         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);
                         }
                     }
                 }
             }];

这里将显示所有具有建议 Facebook id 的朋友。

【讨论】:

    猜你喜欢
    • 2015-07-29
    • 2014-06-26
    • 2013-02-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-02
    相关资源
    最近更新 更多