swift - NSCollectionView error: Parameter indexPath out of bounds or nil -


i've been playing around osx programming (usually ios guy) i've hit strange issue nscollectionview can't seem debug.

when change data data source uses populate collection items, call reloaddata() on collection view usual , hits assertion. error parameter indexpath out of bounds or nil. if don't change data app crashes @ same point(s) though sometimes, first time, works fine , crashes subsequently.

now, i've debugged numerous times. data correct , @ no point in my code ever see nil index path. assertion occurs on makeitemwithidentifier call, , on last item in collection. if continue, either see expect or else of cells previous collection still there behind new cells.

at 1 point refactored code , found error occurring in nscollectionviews itematindexpath: function instead.

has else seen error and, if so, caused it?

update 2: know causing issue, have no idea how prevent it. happens this: user clicks item in collection view. item changes data object data source reading calls reloaddata during collection view delegate's didselectitemsatindexpaths method. reason, after execution of method, collection view queried again cell index path. if table has been reloaded in meantime cell gone, leading exception. in short: can't call 'reload' on collection view while mouse event being processed on 1 of cells without getting annoying assertion. if can think of way around issue, i'd love hear it!


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -