2016-05-29 158 views
7

我在我的代码中得到这个错误,它说:“在UICollectionViewFlowLayoutBreakForInvalidSizes上做一个符号断点,以便在调试器中捕获这个错误。”我很困惑,在这里实际问到的是我认为它要求将其置于哪里的代码,而不知道它在哪里?在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) 
    } 
} 

回答

26

您可以系统地这样做解决这个问题:

此外,你应该分享您的完整的错误,所以我可以带你到更具体的问题。我的想法是,你有你的UICollectionView

你的项目的左边某种的autoLayout问题,请单击断点导航

enter image description here

在底部的加号按钮,然后点击左,点击添加符号断点

enter image description here

然后,你将看到一个弹出窗口。在那里加入UICollectionViewFlowLayoutBreakForInvalidSizes像这样

enter image description here

在此之后,只需点击进入(键盘),然后单击任何地方

运行你的代码,看看那里的项目停止

+0

好完美的,所以我这样做并再次运行应用程序加载Facebook页面,但当我点击添加一张照片时,它只是刷新页面,现在它只是在Xcode中提取: –

+2

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 –

+1

@ThreeSuitStudiosLLC你知道如何理解内存句柄吗? – Jobs