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 2.0 Improving Our User Interface Random Colors

I keep getting this error and I am not quite sure what it means

The error basically comes when I try to build and run the app. It points to this set of code: let randomColor = ColorModel().getRandomColor()

and it has Thread 1: breakpoint 1.1

Did I do something wrong with linking the randomColor?

4 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

Hey Steve,

Without seeing everything, it's kind of a hit-'n-miss guess. If the app successfully builds and runs, I don't think it's an error. Errors usually will result in "Build Failed." It seems that you may have a break-point in your code that will stop it there. Check that. If you do have a break-point set, just delete it and see what happens.

:dizzy:

Will Van de Walle
Will Van de Walle
2,352 Points

Getting the same issue. My code is:

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var FunFactLabel: UILabel!
    let factModel = FactModel()
       override func viewDidLoad() {
        super.viewDidLoad()
        FunFactLabel.text = factModel.getRandomFact()
    }

    @IBOutlet weak var funFactButton: UIButton!

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    @IBAction func showFunFact() {
        let randomColor = ColorModel().getRandomColor
        view.backgroundColor = randomColor()
        funFactButton.tintColor = randomColor()
        FunFactLabel.text = factModel.getRandomFact()
    }

}
Will Van de Walle
Will Van de Walle
2,352 Points

Whoops. That top part is part of the code too.

you need to import Gamekit

KOJI NAKAGAWA
KOJI NAKAGAWA
11,261 Points

I have same problem and not sure why... (running at Swift 3.0)

import UIKit class ViewController: UIViewController {

@IBOutlet weak var funFactLabel: UILabel!
let factModel = FactModel()


@IBOutlet weak var funFactButton: UIButton!

override func viewDidLoad() {
    super.viewDidLoad()
    funFactLabel.text = factModel.getRandomFact()

}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

@IBAction func showFunFact() {
    let randomColor = ColorModel().getRandomColor()
    view.backgroundColor = randomColor

 //* "Thread1: breakpoint 1.1"  
       it seems  this has to be related to the line  "view.backgroundColor = randomColor" 
       but I don't know what is the problem... */

    funFactButton.tintColor = randomColor
    funFactLabel.text = factModel.getRandomFact()        
}

} '''