Ios 错误:执行被中断,原因:内部ObjC异常断点(-5)

Ios 错误:执行被中断,原因:内部ObjC异常断点(-5),ios,swift,xcode,uicollectionview,uicollectionviewcell,Ios,Swift,Xcode,Uicollectionview,Uicollectionviewcell,我试图用自定义的UICollectionViewCell显示UICollectionView,应用程序崩溃,出现以下错误: 2018-07-21 09:14:10.498749+0300托运人[18104:819840]***在-[NSISEngine _optimizeWithoutRebuilding],/BuildRoot/Library/Caches/com.apple.xbs/Sources/Foundation_Sim/Foundation-1452.23/Foundation/La

我试图用自定义的
UICollectionViewCell
显示
UICollectionView
,应用程序崩溃,出现以下错误:

2018-07-21 09:14:10.498749+0300托运人[18104:819840]***在-[NSISEngine _optimizeWithoutRebuilding],/BuildRoot/Library/Caches/com.apple.xbs/Sources/Foundation_Sim/Foundation-1452.23/Foundation/Layout.subj/IncrementalSimplex/NSISEngine.m:1888中的断言失败 错误:执行被中断,原因:内部ObjC异常断点(-5)。。 进程已返回到表达式求值之前的状态

RankingVC
正在作为ChildViewController添加。不确定问题出在哪里,但如果我注释掉文件中的所有
UICollectionView
内容,应用程序不会崩溃,因此一定是出了问题

class RankingVC: UIViewController {

@IBOutlet weak var collectionView: UICollectionView!
override func viewDidLoad() {
    super.viewDidLoad()
    setupCollectionViewDelegates()
    registerCells()
    view.backgroundColor = .red
}
}

extension RankingVC  : UICollectionViewDelegate, UICollectionViewDataSource {

    func setupCollectionViewDelegates() {
        collectionView.delegate = self
        collectionView.dataSource = self
    }

    func numberOfSections(in collectionView: UICollectionView) -> Int {
        return 1
    }

    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return 10
    }

    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {

        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CellIdentifier.rankingCVCell, for: indexPath) as! RankingCVCell
        return cell 
    }

    func registerCells() {
        RegisterCVCells.registerCell(withNibName: CellIdentifier.rankingCVCell, forCollectionView: collectionView)
    }
}

问题是我通过编程将
UICollectionViewCell
的高度设置为高于单元格本身。确保每个单元格的最小高度至少等于最短(就高度而言)的单元格可以解决此问题。

collectionView(u:cellForItemAt:)
方法中,您是否应该将出列单元格强制转换为自定义单元格类?@Chris您是对的,我忘记了这样做,我认为这样可以解决问题,但即使是演员,我还是得到了同样的结果error@Balaji没有改变任何东西,它仍然会以相同的错误崩溃。