error: Execution was interrupted, reason: internal ObjC exception breakpoint(-5)
error: Execution was interrupted, reason: internal ObjC exception breakpoint(-5)
我正在尝试显示带有自定义 UICollectionViewCell
的 UICollectionView
,应用程序崩溃并且出现以下错误:
2018-07-21 09:14:10.498749+0300 Shippers[18104:819840] *** Assertion failure in -[NSISEngine _optimizeWithoutRebuilding], /BuildRoot/Library/Caches/com.apple.xbs/Sources/Foundation_Sim/Foundation-1452.23/Foundation/Layout.subproj/IncrementalSimplex/NSISEngine.m:1888
error: Execution was interrupted, reason: internal ObjC exception breakpoint(-5)..
The process has been returned to the state before expression evaluation.
此 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
的高度设置为高于单元格本身。确保每个单元格的最小高度至少等于最短(就高度而言)的单元格可以解决此问题。
我正在尝试显示带有自定义 UICollectionViewCell
的 UICollectionView
,应用程序崩溃并且出现以下错误:
2018-07-21 09:14:10.498749+0300 Shippers[18104:819840] *** Assertion failure in -[NSISEngine _optimizeWithoutRebuilding], /BuildRoot/Library/Caches/com.apple.xbs/Sources/Foundation_Sim/Foundation-1452.23/Foundation/Layout.subproj/IncrementalSimplex/NSISEngine.m:1888 error: Execution was interrupted, reason: internal ObjC exception breakpoint(-5).. The process has been returned to the state before expression evaluation.
此 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
的高度设置为高于单元格本身。确保每个单元格的最小高度至少等于最短(就高度而言)的单元格可以解决此问题。