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.

  1. the uitableview designed keep small number of cells in memory @ 1 time.
  2. 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

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -