Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Brian Law](https://uploads.teamtreehouse.com/production/profile-photos/7896042/micro_fullsizeoutput_53f.jpg)
Brian Law
4,099 PointsApp crashes, Xcode highlights line with "Thread 1: breakpoint 1.1"
The app crashes without fully loading and I'm not sure why. It doesn't return any specific error, but it does highlight a line from func collectionView
(for me, the function is line 106 in ViewController.swift and the highlighted line is 112. return cell
)
This is my code from the function. It's mostly code that came in the download, I think.
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath) as? VendingItemCell else { fatalError() }
let item = vendingMachine.selection[indexPath.row]
cell.iconView.image = item.icon()
return cell
}
![Brian Law](https://uploads.teamtreehouse.com/production/profile-photos/7896042/micro_fullsizeoutput_53f.jpg)
Brian Law
4,099 PointsThanks for the help! I had set a breakpoint by accident, and had also removed it by accident. Gave me a chance to learn a bit more about breakpoints so not entirely a useless mistake.
2 Answers
![Jason Anders](https://uploads.teamtreehouse.com/production/profile-photos/3512822/micro_Jason_s-Pic.jpg)
Jason Anders
Treehouse Moderator 145,859 PointsHey Brian,
Without actually seeing the whole situation, I can't be 100%, but from the message you posted that Xcode returned, it doesn't look like the app crashed. But rather, it looks like the app stopped at a set breakpoint. Whether you set this break point on purpose or accidentally, I don't know. As for it working now, you may have removed the breakpoint while trying to debug (again either on purpose or accidentally.)
![Caleb Kleveter](https://uploads.teamtreehouse.com/production/profile-photos/1513202/micro_caleb.jpg)
Caleb Kleveter
Treehouse Moderator 37,862 PointsYou will need to remove the breakpoint so you code doesn't pause.
In the gutter on the left side of your code, there will be a fat blue arrow on the line that the code stopped on. Right-click the arrow an select 'Remove breakpoint.' This should solve you problem.
Brian Law
4,099 PointsBrian Law
4,099 PointsI'm going to leave this open in case someone else finds out what might have gone wrong because it might be helpful to others, but it started working. I don't think I made any changes, though I might have accidentally changed something when I was looking at what was going wrong.