【发布时间】:2016-07-10 23:24:36
【问题描述】:
我正在尝试调试我的应用程序,但是当我通过 Xcode 运行它时,我遇到了一个崩溃,提示 -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory:] 这发生在 cellForItemAtIndexPath:对于集合视图,但它仅在我调试时发生,如果我安装应用程序并在没有 Xcode 的情况下运行它,它工作正常。
这是我的代码:
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
FFSIncidentCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];
// Configure the cell
...
}
【问题讨论】:
-
如果你不能提供让问题重现的东西,那就没什么好说的了。您说您的代码以这种方式运行。证明它。
-
也许你可以展示你的 cellForItemAtIndexPath 实现?
-
这是我的代码... - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { FFSIncidentCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath]; // 配置单元格
-
它在那条线上中断了,但我不知道为什么。它昨天工作,我什么都没改变,但今天,crashola。
-
当它“崩溃”时,它不仅仅是一个方法名称。通常在调试控制台和/或 Xcode 暂停执行中有更完整的描述,直观地向您显示它停止的位置,以及原因。您可以考虑添加exception breakpoint。但是,归根结底,您的问题中没有足够的信息供我们诊断问题。
标签: ios objective-c uicollectionview