Search code examples
iosobjective-cfacebook-ios-sdk

FBFriendPickerViewController is empty


I'm using Facebook SDK for iOS v3.14.1

I have the following code which allocs and inits an FBFriendPickerViewController, then presents it. The second line of code is just COCOS2D's way of presenting a view controller. The view controller itself is being presented okay.

FBFriendPickerViewController *friendPicker = [[FBFriendPickerViewController alloc] init];
[[CCDirector sharedDirector] presentModalViewController:friendPicker animated:YES];

The problem: The FBFriendPickerViewController is empty when it's presented.

Things I've tried:

I've made sure I've requested the proper permissions from the user, i.e. user_friends. A call to FBRequestConnection with /me/permissions parameter, show I have permission to see the user's friend list:

permission = "user_friends";
status = granted;

I've tried things suggested in other SO questions, but I suspect they're out of date, or at least aren't working for me.

FBFriendPickerViewController is loading a empty tableview intermittently

FBFriendPickerViewController showing and empty table on iOS. Place Picker running fine


Solution

  • You have to call `loadData' on your view controller. So, full code is:

    FBFriendPickerViewController *friendPicker = [[FBFriendPickerViewController alloc] init];
    [friendPicker loadData];
    [[CCDirector sharedDirector] presentModalViewController:friendPicker animated:YES];