Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

anim510

macrumors newbie
Original poster
Oct 20, 2008
15
0
Hi all,

I use the tableView to show my records, and i use this function to move the rows.
Code:
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath

It's will be crash every time when i move the rows, if i call this function.
Code:
[myTableView reloadData];

It's will be duplicate if i don't reload data, and it's never be crash.

Has anyone can help me ? Thanks very much. :)

regards,
Neil
 

anim510

macrumors newbie
Original poster
Oct 20, 2008
15
0
Error ..

Whats errors are you seeing in the console/debugger when your app crashes?

The error is:

*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray insertObject:atIndex:]: index (3) beyond bounds (1)'
 

jnic

macrumors 6502a
Oct 24, 2008
567
0
Cambridge
The error is:

*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray insertObject:atIndex:]: index (3) beyond bounds (1)'

This means that your data array only contains 1 item, but you're trying to read item 3 (which doesn't exist) and it's causing your app to crash.

You need to check the parts of your code where you add and read data and ensure that you're never reading data before you've added it.
 

anim510

macrumors newbie
Original poster
Oct 20, 2008
15
0
Thanks buddy!

This means that your data array only contains 1 item, but you're trying to read item 3 (which doesn't exist) and it's causing your app to crash.

You need to check the parts of your code where you add and read data and ensure that you're never reading data before you've added it.


Thanks buddy!

I will be check it.

Thanks for your suggestion.:)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.