【问题标题】:Facebook sdk 3.5.1 invite friends request makes double selecting in iosFacebook sdk 3.5.1 邀请好友请求在 ios 中进行双重选择
【发布时间】:2013-05-18 12:03:37
【问题描述】:

我的fb SDK 3.2没有这个问题,但是在我升级到SDK 3.5.1之后,好友邀请者出现了一些奇怪的问题,当我选择一位朋友时,它选择了选定的一位和它下面的一位。此外,当我尝试向下滚动时,它会重新启动表格并将我带回桌面。 这是我的方法:

-(IBAction)secondClick:(id)sender
{
NSDictionary *params = [[NSDictionary alloc] initWithObjectsAndKeys:nil];

[FBWebDialogs
 presentRequestsDialogModallyWithSession:nil
 message:@"Learn how to make your iOS apps social."
 title:@"Test"
 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);
             }
         }
     }
 }];

【问题讨论】:

  • 我在 SDK 3.2 中也面临同样的问题。它工作正常,直到大约一周前。我也在我的安卓设备上的 Candy Crush Saga 中注意到了同样的问题。
  • @Dejan ,如果你得到答复,我有同样的问题,请通知我

标签: ios facebook sdk facebook-invite


【解决方案1】:

据我所知,facebook 已经修复了这个问题,并且很快就会修复。 另一种解决方案是制作您自己的自定义 UI。 1. 获取好友列表 - [self startConnectionWithGraphPath:@"me/friends" 参数:params method:@"GET" completionSelector:@selector(callback)]

  1. 使用url下载图片@"https://graph.facebook.com/fbid/picture"

  2. 实现一个类似于 facebook 请求 ui 的表格视图,显示朋友列表及其个人资料照片。

  3. 使用“to”参数将请求定向到选定的用户。 NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: @"286400088", @"to", nil];

这样您就不需要显示 facebook ui 来选择朋友。虽然在用户从您的自定义 UI 中选择朋友后,该 UI 仍会出现,但这只是点击“发送”。

【讨论】:

    【解决方案2】:

    一种方法是使用 Facebook friendPicker

    https://developers.facebook.com/ios/friendpicker-ui-control/

    然后将 facebook id 的结果放入 requestdialog 中,就像 Nitin 说的那样。

    我会发布我的friendPicker代码:

    - (IBAction)inviteFriendsClicked:(id)sender {
    
        // Initialize the friend picker
    
    
        FBFriendPickerViewController *friendPickerController =
        [[FBFriendPickerViewController alloc] init];
        // Set the friend picker title
        friendPickerController.title = @"Välj vänner";
    
        // TODO: Set up the delegate to handle picker callbacks, ex: Done/Cancel button
    
        // Load the friend data
        [friendPickerController loadData];
        // Show the picker modally
        [friendPickerController presentModallyFromViewController:self
                                                        animated:YES
                                                         handler:
         ^(FBViewController *sender, BOOL donePressed) {
             if(donePressed) {
                 NSString *userString;
                 userString = @"";
                 int *counter = 0;
                 for (id<FBGraphUser> user in friendPickerController.selection) {
                     NSLog(user.id);
                     NSMutableArray *userArray = [[NSMutableArray alloc] init];
                     [userArray addObject:user.id];
    
                     if(counter == 0){
                         userString = user.id;
                     }else{
                         userString = [NSString stringWithFormat:@"%@%@%@", userString, @",", user.id];
                     }
    
                     counter++;
    
                 }
    
                 if(counter != 0){
                     [self requestDialog: userString]; // Display the requests dialog and send the id-string with it
                 }
                 // NSLog(@"Selected friends: %@", friendPickerController.selection);
             }
         }];
    
    
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多