ios - 在 UICollectionViewFlowLayoutBreakForInvalidSizes 做一个符号断点

标签 ios xcode 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)
    }
}

最佳答案

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

此外,您应该分享您的完整错误,以便我可以引导您解决更具体的问题。我的想法是您的 UICollectionView 中存在某种自动布局问题

在项目的左侧,单击 Break Point 导航器

enter image description here

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

enter image description here

然后您将看到一个弹出窗口。像这样在其中添加 UICollectionViewFlowLayoutBreakForInvalidSizes

enter image description here

在此之后,只需按回车键(在键盘上)并点击任意位置

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

关于ios - 在 UICollectionViewFlowLayoutBreakForInvalidSizes 做一个符号断点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37511039/

相关文章:

ios - XCode - 删除核心数据中的相关对象

ios - 将 Azure ADAL 库添加到 iOS native 应用程序时资源包出现问题

ios - 使用 af_setImageWithURL 在 UICollectionViewCell 中设置图像会消耗大量内存

ios - 在 UICollectionView(或 UITableView)swift 中循环数据

ios - 无法从iOS 10中的App组共享容器中获取扩展应用程序中的图像

ios - WL.Device.Geo.acquirePosition 不工作

ios - xcodebuild 可以管理自动签名吗?

ios - 在 UICollectionView 中构建非常灵活/动态的 "header"的最佳方法是什么

javascript - 我如何在 swift 代码中调用这个 javascript 函数

ios - 从 UITableView(不是 UITableViewController)转到 UIViewController