我M在UICollectionView
UICollectionView断言失败
断言失败收到此错误上执行insertItemsAtIndexPaths
在:
-[UICollectionViewData indexPathForItemAtGlobalIndex:],
/SourceCache/UIKit/UIKit-2372/UICollectionViewData.m:442
2012-09-26 18:12:34.432
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'request for index path for global index 805306367
when there are only 1 items in the collection view'
我已经检查过我的数据源仅包含一个元素。 关于为什么会发生这种情况的任何见解?如果需要更多信息,我绝对可以提供。
这似乎是正确的答案。如果您插入第一个单元格,则会发生崩溃。这个问题有一个开放的雷达:http://openradar.appspot.com/12954582其中说,如果您使用“装饰视图”(节头或页脚),问题也只会发生。 – chris
对第一项使用reloadData和对以下项目使用insertItemsAtIndexPaths的补充视图不适用于我。但是,如果我禁用补充视图,那么它的作品。如果我只使用reloadData,它可以工作。可悲的是我想用我的KVO代码使用-insertItemsAtIndexPaths。 – neoneye
来扩展这个答案,如果我在'performBatchUpdates:'块之外和之前调用'reloadData',UI会根据需要进行更新并且崩溃消失。 – toblerpwn