Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

清除cell 报错 'UICollectionView received layout attributes for a cell with an index path that does not exist: #1

Open
SpectatorNan opened this issue Jun 15, 2017 · 1 comment

Comments

@SpectatorNan
Copy link

我在清除cellectionview 的时候 cell数量为0刷新 会报以下错误:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UICollectionView received layout attributes for a cell with an index path that does not exist: <NSIndexPath: 0xc000000000000016> {length = 2, path = 0 - 0}'
*** First throw call stack:

@wjywjwww
Copy link
Owner

我在这个Demo里面的viewDidLoad 里面加了一句延迟调用
perform(#selector(ViewController.some), with: nil, afterDelay: 2)
func some(){
dataArray.removeAll()
self.collectionView.reloadData()
}
然后2秒之后Collectionview所有的Cell会正常消失,没有发生Crash。
不过网上百度了一下这个问题
https://stackoverflow.com/questions/18339030/uicollectionview-assertion-error-on-stale-data
这个网址里面的解决方案你可以看一下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants