Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift 理解iPhone的崩溃日志_Swift_Xcode_Logging_Runtime Error - Fatal编程技术网

Swift 理解iPhone的崩溃日志

Swift 理解iPhone的崩溃日志,swift,xcode,logging,runtime-error,Swift,Xcode,Logging,Runtime Error,我是一个初学者开发人员,他尽了最大的努力。目前我正在开发一个复杂的应用程序,一切都很好:期待一件事。100次中有1次基本的东西会使我的应用程序崩溃 (此应用程序是一个社交发布应用程序) 1.当我打开帖子查看评论时,一切正常。99%的时间。但上次它不知从哪里掉下来了。我真的不明白 2.前一次我在1小时未使用应用程序后打开应用程序,突然应用程序崩溃 有人能帮我吗?我下面的猜测对吗 第一种情况: 我认为这是由于重新加载Sections:withRowAnimation:造成的。我说得对吗 第二种情

我是一个初学者开发人员,他尽了最大的努力。目前我正在开发一个复杂的应用程序,一切都很好:期待一件事。100次中有1次基本的东西会使我的应用程序崩溃

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


1.当我打开帖子查看评论时,一切正常。99%的时间。但上次它不知从哪里掉下来了。我真的不明白

2.前一次我在1小时未使用应用程序后打开应用程序,突然应用程序崩溃

有人能帮我吗?我下面的猜测对吗

第一种情况:

我认为这是由于重新加载Sections:withRowAnimation:造成的。我说得对吗

第二种情况:

这是因为我调用了一个集合视图。对吧?


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

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

它是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 :
        // ...

为什么在构建单元格时要刷新它?因为集合的数据源每10秒更改一次,如果我不重新加载它,它就不会显示正确的单元格(带有图像),所以此UIView位于单元格内部,对吗?这个名字有点模棱两可。但是我会尝试从tableView中刷新单元格,而不是从单元格本身,在创建单元格之后。我的应用程序的tableView中充满了post单元格。但在顶部(第0部分),它有一个包含collectionView的单元格。我试试看,谢谢!或者,如果该单元格完全不同,则将其从tableView中分离出来,并作为独立的collectionView放置,每次tableVew数据源发生更改时,您都将刷新该单元格。