iOS好友的iOS桌面视图

时间:2014-05-21 02:38:13

标签: ios facebook uitableview

我正试图在UITableView的应用中显示来自 Facebook 的朋友。但是,我TableView保持空白。以下是我提取UITableView

的代码
-(IBAction)testfriends {
    FBFriendPickerViewController *friendPickerController = [[FBFriendPickerViewController alloc] init];
    friendPickerController.title = @"Pick Friends";
    [friendPickerController loadData];

    // Use the modal wrapper method to display the picker.
    [friendPickerController presentModallyFromViewController:self animated:YES handler:
     ^(FBViewController *innerSender, BOOL donePressed) {
         if (!donePressed) {
             return;
         }

         NSString *message;

         if (friendPickerController.selection.count == 0) {
             message = @"<No Friends Selected>";
         } else {

             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 friendPickerController.selection) {
                 if ([text length]) {
                     [text appendString:@", "];
                 }
                 [text appendString:user.name];
             }
             message = text;
         }

         [[[UIAlertView alloc] initWithTitle:@"You Picked:"
                                     message:message
                                    delegate:nil
                           cancelButtonTitle:@"OK"
                           otherButtonTitles:nil]
          show];
     }];
}

我在这里缺少什么?它直接来自Facebook Sample,但即使在示例应用程序中,也无法工作。

1 个答案:

答案 0 :(得分:1)

截至2014年4月30日,随着Graph API v2.0的推出,您需要申请user_friends权限,并且您只会收到也使用该应用的朋友。