iphone - insertRowsAtIndexPaths crashes on endUpdates in tableView:willDisplayCell:forRowAtIndexPath only if user scrolls quickly -
ok title suggests, trying insert more rows in uitableview when user scrolls bottom of list. whole reason lazily load data performance reasons large data set.
the odd thing if scroll works fine, if scroll crashes on [tableview endupdates];
the datasource nsmutablearray loads data coredata, using common fetchrequest. cannot use fetchedresultscontroller in current circumstances.
the datasource count correct before , after insert called. row count (and data source count) correct.
if scroll , later @ point scroll quickly, crashes, same error index being beyond bounds, index , bounds in error message incorrect original counts when tableview first bound (and before insertions occured). ie row count of 4 , datasource count of 4 & etc.
this error:
terminating app due uncaught exception 'nsrangeexception', reason: '*** -[__nsarraym objectatindex:]: index 3 beyond bounds [0 .. 2]'
i tried inserting rows during cellforrowatindexpath method same result.
any ideas?
that not right way solve large data set scrolling problems.
- the
uitableview
designed keep small number of cells in memory @ 1 time. - trying fetch data while scrolling perform horribly disk access slower ui updates.
instead should consider limiting batch size when fetching data core data. secondarily should run instruments against app , confirm hotspots are. highly unlikely scrolling or population of cells slow point.
btw, nsmutablearray
useful when dealing results core data. unless have specific reason have nsmutablearray
should change nsarray
.
Comments
Post a Comment