*** Assertion failure in -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:], /SourceCache/UIKit/UIKit-3347.44/UICollectionView.m:4072 1、首先是检查删除的方法有没有问题。问了其他开发人员,百度,谷歌了确认删除的方法是没有问题的。 2、再次去谷歌粗暴的百度了一下,还是无果。 3、难道无解,再次仔细看错误信息 *** Assertion failure in -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:], /SourceCache/UIKit/UIKit-3347.44/UICollectionView.m:4072 2015-05-13 16:23:57.163 SmartHome[463:138180] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of items in section 0. The number of items contained in an existing section after the update (20) must be equal to the number of items contained in that section before the update (20), plus or minus the number of items inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of items moved into or out of that section (0 moved in, 0 moved out).' *** First throw call stack: (0x286c4fef 0x36976c8b 0x286c4ec5 0x293c3f17 0x2c31b42b 0x2c31da8f 0x2c31d8f3 0x2beda667 0x125ae5 0x70d03 0x7075d 0x2be9706b 0x2bd460f9 0x2c15ff9b 0x2bd0f181 0x2bd0d05f 0x2bd444d9 0x2bd43ddd 0x2bd19fe5 0x2bf908fb 0x2bd189f9 0x2868afaf 0x2868a3bf 0x28688a25 0x285d5201 0x285d5013 0x2feb4201 0x2bd79a59 0x116a85 0x36f02aaf) libc++abi.dylib: terminating with uncaught exception of type NSException 原来是numberOfItemsInSection的返回值写的固定值,在删除了一个cell之后reloadData会触发numberOfRowsInSection,此时返回的cell数量与实际的cell数量已经不一致了,所以导致了数组越界,而崩溃了。