我无法显示列表朋友 facebook,我正在使用 FBRequest,我已经获得列表朋友但它没有显示在 UITableView
这是我的代码:
- (void)viewDidLoad
{
[self.tblView setDataSource:self];
[self.tblView setDelegate:self];
[super viewDidLoad];
[self loadFirst];
_itemsNamesFriend = [[NSMutableArray alloc] init];
if (FBSession.activeSession.isOpen) {
FBRequest *friendRequest = [[FBRequest alloc] initWithSession:FBSession.activeSession graphPath:@"me/friends"];
[friendRequest startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
NSDictionary *resultDictionary = (NSDictionary *)result;
_itemsNamesFriend = [resultDictionary objectForKey:@"data"];
NSLog(@"%@",_itemsNamesFriend); //--> have data
}];
NSLog(@"%@",_itemsNamesFriend); //--> data is empty
[self.tblView reloadData];
}
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// NSLog(@"%d",_itemsNamesFriend.count);
return _itemsNamesFriend.count;
}