28

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?

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)
    }
}
Krunal
  • 77,632
  • 48
  • 245
  • 261

2 Answers2

48

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

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

enter image description here

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

enter image description here

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

enter image description here

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

Run your code and see where the project stops

Akshansh Thakur
  • 5,163
  • 2
  • 21
  • 38
  • Ok perfect so I did that and ran the app again its loading the Facebook page but when I click to add a photo it just refreshes the page well it did before now it just pulls this up in Xcode: – Three Suit Studios LLC May 29 '16 at 15:20
  • 3
    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 ; symbol stub for: NSLog – Three Suit Studios LLC May 29 '16 at 15:20
  • 1
    @ThreeSuitStudiosLLC did you figure out how to make sense of the memory handles? – Jobs Mar 27 '17 at 10:13
  • @Akshansh Thakur Thanks man ! It helped me in solving the frame issue in the collection view which I had implemented. – Rizwan Ahmed May 30 '17 at 06:06
  • 1
    @RizwanAhmed glad it helped :) – Akshansh Thakur Jun 04 '17 at 00:01
  • 20
    But when it stops then it shows me a series of assembly statements which are hard to make sense of. What's the next step? – Alper Sep 24 '18 at 09:58
  • @alper look in the console output for more debug information from Apple. For example mine has: The behavior of the UICollectionViewFlowLayout is not defined because: the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values. – suite22 Sep 24 '18 at 19:41
  • @suite22, even i got same error in my objective c project. Can you please tell me how you solved the issue. – Arshad Shaik Nov 15 '18 at 09:25
  • 1
    @suite22 did you ever found the solution for that regarding "item height must be less than the height of the UICollectionView" im running into same problem. – Kenny Ho Jul 19 '21 at 17:23
  • @KennyHo I have found a solution here https://stackoverflow.com/questions/23596181/why-does-uicollectionview-log-an-error-when-the-cells-are-fullscreen – Mohammad Daihan Mar 24 '22 at 09:31
0

You can resolve this issue by setting 'Estimate size = Custom' of collectionView in size inspector.