-1

I have been trying to figure out why this error is happening for a while I put the tableview in view controller. Set the tableview delegate and datasource to view controller. I have implemented the delegate and datasource protocols.

I have done the same scene in fresh project almost 4 times, It worked fine. When I am trying to implement this scene in my current projects I see this error.

If I remove setting the delegate of table view then everything goes fine.

It is happening after returning cell.

What could be the reason? I am unable to figure it.I am using no arrays too.

enter image description here

meda
  • 45,103
  • 14
  • 92
  • 122
Balu mallisetty
  • 603
  • 9
  • 19
  • please show the full code,screenshot is not too helpful, paste all the code involved. also why not using array – meda Oct 26 '15 at 23:33
  • 1
    Update your question with relevant code (pasted as text). Point out where the error actually happens. – rmaddy Oct 26 '15 at 23:41
  • The error is most likely due to your datasource and you are not showing that. – Daniel Zhang Oct 26 '15 at 23:50
  • I already used this methods in other tableview. //-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath; - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath So I had to rewrite it in current scene. Thanks – Balu mallisetty Oct 27 '15 at 00:14
  • Possible duplicate of [index 0 beyond bounds for empty array error](http://stackoverflow.com/questions/4870600/index-0-beyond-bounds-for-empty-array-error) – abhimuralidharan Oct 27 '15 at 05:42

2 Answers2

8

Try adding an all-exception breakpoint (Add Exception Breakpoint) to debug where the exception occures. Maybe it is not even in that viewcontroller. Add Exception Breakpoint

Kádi
  • 2,796
  • 1
  • 16
  • 22
1

1) Use Exception Break points...As per the above answer make sure if the delegate methods were set in previous scenes of the project.

I used all the below methods:

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
Dharmesh Dhorajiya
  • 3,976
  • 9
  • 30
  • 39
Balu mallisetty
  • 603
  • 9
  • 19