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

iOS Build a Simple iPhone App with Swift Improving Our User Interface Adding a Pop of Color

Thread 1: breakpoint 2.1

How do i fix it?

struct ColorWheel { let colorsArray = [ UIColor(red: 90/255.0, green: 187/255.0, blue: 181/255.0, alpha: 1.0), //teal color UIColor(red: 222/255.0, green: 171/255.0, blue: 66/255.0, alpha: 1.0), //yellow color UIColor(red: 223/255.0, green: 86/255.0, blue: 94/255.0, alpha: 1.0), //red color UIColor(red: 239/255.0, green: 130/255.0, blue: 100/255.0, alpha: 1.0), //orange color UIColor(red: 77/255.0, green: 75/255.0, blue: 82/255.0, alpha: 1.0), //dark color UIColor(red: 105/255.0, green: 94/255.0, blue: 133/255.0, alpha: 1.0), //purple color UIColor(red: 85/255.0, green: 176/255.0, blue: 112/255.0, alpha: 1.0), //green color ]

func randomColor() -> UIColor {
    var UnsignedArrayCount = UInt32(colorsArray.count)
    var UnsignedRandomNumber = arc4random_uniform(UnsignedArrayCount)
    var RandomNumber = Int(UnsignedRandomNumber )


    return colorsArray[RandomNumber]

}

}

6 Answers

Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,862 Points

Go to were the code is to display a new fun fact and look in the gutter (on the left side of the code) for a thick blue arrow, if their is one there then right click on it and select "delete breakpoint" and re-run the app.

Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,862 Points

When you run the app are you getting an error about a break point?

The app loads normally and when i press the "show new fun fact" button it crashes and returns an error "Thread 1: breakpoint 2.1"

Thanks man!

Christopher Mayfield
Christopher Mayfield
19,928 Points

Thanks Caleb, do you know why this happens?

Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,862 Points

It's most likely because the person accidentally clicks in the gutter.

Christopher Mayfield
Christopher Mayfield
19,928 Points

Thanks Caleb, I don't know much about debugging, but looking forward to learning more.