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

mr tickle

macrumors newbie
Original poster
May 23, 2009
1
0
Im not sure if this has been mentioned before, but it took me a while to find this, and i didnt locate it on any forums

when running my application (table view with the option to delete) in iphone 2.2 sim, it would crash out saying that the number of rows should equal the number of rows previously (plus or minus 1).

i was feeding data from a mutablearray, so it was confusing as hell, and even when i traced out values, it seemed all fine, then, i thought

what happens if the operation is happening before i delete from the array...

so i reversed the following

[tableView deleteRowsAtIndexPaths:[NSMutableArray arrayWithObject:indexPath.......
[self.myArray removeObjectAtIndex:indexPath.row];

TO >>>

[self.myArray removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:[NSMutableArray arrayWithObject:indexPath.......

and it works

thus meaning, that the whole reload must have been happening before i had a chance to remove from the array, and checked the total length against its rows, which was not the case in iphone 2.1.

hope this helps someone. And hope it makes sense
 
Thanks for sharing, these things are kinda tough to figure out given how xcode changes
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.