2

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
Stack.Blue
  • 195
  • 4
  • 12
  • Please summarize the question in the title. –  Jun 29 '12 at 04:43
  • Insufficient data provided by you. Also have you set the delegate to self in your method while initializing table view – Sumanth Jun 29 '12 at 04:44
  • what is the problem in reloading when you get the data... everyone does this... – Inder Kumar Rathore Jun 29 '12 at 04:44
  • 1
    title of the question looks tags to me :) – janusfidel Jun 29 '12 at 04:46
  • @InderKumarRathore problem is . my [array count] prints 164 in numberOfRowsInSection but cellForRowAtIndexPath not executed – Stack.Blue Jun 29 '12 at 04:59
  • @janusfidel ha ha ha.. you are right... – Inder Kumar Rathore Jun 29 '12 at 05:02
  • @Stack.Blue: Have you put break point in cellForRowAtIndexPath to check if the the program enters it or not?? Also have you checked if the cellForRowAtIndexPath method has correct spellings?? – Tripti Kumar Jun 29 '12 at 05:03
  • if your number of rows is called with 164 then it must call your cellforrow.. for 164 times.. put log in your cellforrow and check it – Inder Kumar Rathore Jun 29 '12 at 05:04
  • @iPhoneDeveloper yes.i put break points. it prints [array counts] 164 in numberOfRowsInSection but not execute the cellForRowAtIndexPath – Stack.Blue Jun 29 '12 at 05:05
  • @Stack.Blue:What is your table showing after all the methods have executed??does it shows any value or is it empty??? also check for the spellings of your methods.. – Tripti Kumar Jun 29 '12 at 05:12
  • @iPhoneDeveloper only problem is that my table view not reload again. i attach it with delegate and data source already and my spellings are right. – Stack.Blue Jun 29 '12 at 05:59
  • @Stack.Blue: Put a break point on [self.tableView reloadData]; and check if the table view has memory or it is nil. – Tripti Kumar Jun 29 '12 at 06:00
  • @iPhoneDeveloper you are right .. memory nil. now what to do? when first time view did load call it works fine but for second time memory nil; – Stack.Blue Jun 29 '12 at 06:05
  • @Stack.Blue:Are you navigating into too many classes simultaneously??? or you may have added the tableview through XIB. Try to create it programatically in the viewDidLoad.That may solve it. – Tripti Kumar Jun 29 '12 at 06:13
  • @iPhoneDeveloper .. first thanks. yes i am navigating into two classes. i create table view programmatically . but my viewDidLoad methods calls only once. see my code above you understand clear.. FBFriends class object two time created 1) for navigation to that view and 2) for passing array by method. hope you understand my problem – Stack.Blue Jun 29 '12 at 06:25
  • @iPhoneDeveloper. thanks a lot you give me your time . now i am changing my all code.. thanks again :) – Stack.Blue Jun 29 '12 at 06:38
  • You are welcome:) do let me know if there is again some issue. – Tripti Kumar Jun 29 '12 at 06:40

1 Answers1

2

@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.

Tripti Kumar
  • 1,559
  • 14
  • 28
  • Thanks. For me, it was the `retain` keyword that did it. In my case, using ARC, it was the `strong` keyword. – Alex Jan 29 '13 at 15:00