Ios – numberOfRowsInSection called but cellForRowAtIndexPath not called

facebookiosiphoneparsingtableview

In my tableView numberOfRowsInSection is called two times but cellForRowAtIndexPath not called ? I wants to display Facebook friends list in tableView (if cellForRowAtIndexPath called my problem solved).

I get the right value in my array here but First time when table method called because parsing of friend list not complete it not goes to cellForRowAtIndexPath but next time when I reload data it shows value 194(my friends in facebood) in numberOfRowsInSection but still not goes cellForRowAtIndexPath. I am very tired with that problem ?

@implement RootViewController


//In this view i do two things. First use FBFeedPost to Fetch the Friend List from    Facebook and Second navigate to FBFriends view



FBFeedPost *post = [[FBFeedPost alloc]initWithFriendList:self.imageView.image];
    [post publishPostWithDelegate:self];


FBFriends *friendList=[[FBFriends alloc]initWithNibName:@"FBFriends" bundle:[NSBundle mainBundle]];
[[self navigationController] pushViewController:friendList  animated:YES];

@end


@implement FBFeedPost

//After parsing friends list i pass Array to a FBFriend class function   

FBFriends *obj1=[[FBFriends alloc]init];
[obj1 getFreindName:nameItems];

@end



@implement FBFriends


-(void)getFreindName:(NSMutableArray *)friendName
{
    friendsArray=friendName;

    NSLog(@"the count of name is %d",[friendsArray count]);// here i get right answer.

    [self.tableView reloadData];

}


@end

Best Solution

@Stack.Blue:ok what property have you used for tableView??Use @property(nonatomic,retain)UITableView *tableView; or next option is you can try adding the table in viewWillAppear method.Do let me know if it works.