首页 > 解决方案 > 了解崩溃日志 iPhone

问题描述

我是一名初学者开发人员,他会尽力而为。目前我正在处理一个复杂的应用程序,一切正常:期待一件事。100 次中有 1 次基本的事情会导致我的应用程序崩溃。

(此应用程序是一个社交发布应用程序)


1.当我打开帖子查看评论时,一切正常。99% 的时间。但上次它突然崩溃了。我真的不明白。

2.另外一次我打开应用程序1小时没有使用,突然应用程序崩溃了。

有人可以帮我吗?我对以下猜测正确吗?

第一种情况: Pastebin 链接

我认为这是由reloadSections:withRowAnimation:引起的。我对么?

第二种情况: Pastebin Link

这是因为performBatchUpdates我调用了一个集合视图。正确的?


但我真的不明白问题的根源在哪里。

这是我的代码,它看起来完全无害(对于第二个示例):

它是 tableCell 内的集合视图

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

        switch indexPath.section {
        case 0 :
            let cell = tableView.dequeueReusableCell(withIdentifier: "StoriesCell", for: indexPath) as! StoriesCell


            // Could use cell.storiesCollectionView.reloadData() too, but it flickers then
            UIView.animate(withDuration: 0, animations: {
                cell.storiesCollectionView.performBatchUpdates({
                    cell.storiesCollectionView.reloadSections(IndexSet(0...0))
                })
            })
            cell.setCollectionViewDataSourceDelegate(self, forRow: indexPath.row)
            cell.collectionViewOffset = storedStoriesCollectionViewOffset[indexPath.row] ?? 0

            return cell
        case 2 :
        // ...

标签: swiftxcodeloggingruntime-error

解决方案


推荐阅读