在UICollectionViewFlowLayoutBreakForInvalidSizes处创建一个符号断点

时间:2023-01-07 16:26:25

I am getting this error in my code it says to "Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger." I am confused as to what it is actually asking here is the code in which I am thinking its asking it to be put in just not sure where?

我在我的代码中收到此错误,它说“在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)
    }
}

1 个解决方案

#1


33  

You can systematically solve this by doing this:

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

Also, you should share your complete error, so that I can lead you to more specific issue. My thinking is that you have some sort of autoLayout issue in your UICollectionView

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

On the left of your project, click the Break Point navigator

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

在UICollectionViewFlowLayoutBreakForInvalidSizes处创建一个符号断点

Next click on the plus button on the bottom left and click Add Symbolic BreakPoint

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

在UICollectionViewFlowLayoutBreakForInvalidSizes处创建一个符号断点

Then you will be shown a popup. Add UICollectionViewFlowLayoutBreakForInvalidSizes in there like so

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

在UICollectionViewFlowLayoutBreakForInvalidSizes处创建一个符号断点

After this, just hit enter(on keyboard) and click anywhere

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

Run your code and see where the project stops

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

#1


33  

You can systematically solve this by doing this:

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

Also, you should share your complete error, so that I can lead you to more specific issue. My thinking is that you have some sort of autoLayout issue in your UICollectionView

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

On the left of your project, click the Break Point navigator

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

在UICollectionViewFlowLayoutBreakForInvalidSizes处创建一个符号断点

Next click on the plus button on the bottom left and click Add Symbolic BreakPoint

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

在UICollectionViewFlowLayoutBreakForInvalidSizes处创建一个符号断点

Then you will be shown a popup. Add UICollectionViewFlowLayoutBreakForInvalidSizes in there like so

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

在UICollectionViewFlowLayoutBreakForInvalidSizes处创建一个符号断点

After this, just hit enter(on keyboard) and click anywhere

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

Run your code and see where the project stops

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