在UICollectionViewFlowLayoutBreakForInvalidSizes处创建一个符号断点

Thr*_*LLC 19 xcode ios uicollectionview swift2

我在我的代码中得到了这个错误,它说" UICollectionViewFlowLayoutBreakForInvalidSizes在调试器中创建一个符号断点".我很困惑,实际上这里问的是我正在考虑的代码,要求它放在哪里,不知道在哪里?

import UIKit

// MARK: - CUSTOM SOCIAL CELL
class SocialCell:UICollectionViewCell {

    /* Views */
    @IBOutlet weak var socialIcon: UIImageView!
    @IBOutlet weak var socialLabel: UILabel!
}

class SocialList: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {

    /* Views */
    @IBOutlet weak var socialCollView: UICollectionView!

    override func viewDidLoad() {
        super.viewDidLoad()

    }

    // MARK: - COLLECTION VIEW DELEGATES 
    func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
        return 1
    }

    func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return socials.count //socialNames.count
    }

    func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCellWithReuseIdentifier("SocialCell", forIndexPath: indexPath) as! SocialCell

        cell.socialLabel.text = "\(socials[indexPath.row]["name"]!)"
        cell.socialIcon.image = UIImage(named: "\(socials[indexPath.row]["name"]!)")

        return cell
    }

    func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
        return CGSizeMake(view.frame.size.width/3.8, view.frame.size.width/3.8)
    }

    func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
        selectedSocial = "\(socials[indexPath.row]["link"]!)"
        selectedName = "\(socials[indexPath.row]["name"]!)"
        selectedColor = socialColors[indexPath.row]

        navigationController?.popViewControllerAnimated(true)
    }
}
Run Code Online (Sandbox Code Playgroud)

Aks*_*kur 39

你可以通过这样做系统地解决这个问题:

此外,您应该分享您的完整错误,以便我可以引导您解决更具体的问题.我的想法是你在UICollectionView中有某种autoLayout问题

在项目的左侧,单击"断点"导航器

在此输入图像描述

接下来单击左下角的加号按钮,然后单击Add Symbolic BreakPoint

在此输入图像描述

然后你会看到一个弹出窗口.在那里添加UICollectionViewFlowLayoutBreakForInvalidSizes就像这样

在此输入图像描述

在此之后,只需按Enter键(在键盘上)并单击任意位置

运行代码并查看项目停止的位置

  • 但是当它停止时,它会向我展示一系列难以理解的汇编语句.下一步是什么? (8认同)
  • UIKit`UICollectionViewFlowLayoutBreakForInvalidSizes: - > 0x1123ebabc <+0>:pushq%rbp 0x1123ebabd <+1>:movq%rsp,%rbp 0x1123ebac0 <+4>:testq%rdi,%rdi 0x1123ebac3 <+7>:je 0x1123ebac7; <+11> 0x1123ebac5 <+9>:popq%rbp 0x1123ebac6 <+10>:retq 0x1123ebac7 <+11>:leaq 0x4a1042(%rip),%rdi; @"''"0x1123ebace <+18>:xorl%eax,%eax 0x1123ebad0 <+20>:popq%rbp 0x1123ebad1 <+21>:jmp 0x1125b3e90; 符号存根:NSLog (3认同)