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 Views and View Controllers IBOutlet

Peter O'Brien
Peter O'Brien
9,348 Points

How do I fix the breakpoint on clicking the button in Fun Facts iOS app?

The app compiles fine, but on clicking the button to retrieve the new string, it hits a Thread 1: Breakpoint 1:1. This was the state output

self FunFacts.ViewController 0x7b7467c0 0x7b7467c0 UIKit.UIViewController UIViewController
UIKit.UIResponder UIResponder
ObjectiveC.NSObject NSObject
funFactLabel UILabel! "1 value" Some [0] UILabel * 0x7b7a7800 0x7b7a7800 [0] UILabel

(lldb)

My code looks like this.

class ViewController: UIViewController {

    @IBOutlet weak var funFactLabel: UILabel!

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    @IBAction func showFunFact() {
        funFactLabel.text = "Another Interesting Fact"
    }


}

I'm not sure if its relevant, but when I started coding this the original @IBOutlet code was this:

@IBOutlet var funFactLabel: [UILabel]!

However, this code would not allow me to use .text and would not run with .description.

Help... I've hit a wall.

Thanks, Pete

3 Answers

Stone Preston
Stone Preston
42,016 Points

you can hit command + y to disable all breakpoints. to delete it completely press command + 6 to show the breakpoint navigator. right click the breakpoint in the breakpoint navigator and select remove

Peter O'Brien
Peter O'Brien
9,348 Points

Thanks, Stone. So you don't think the breakpoint has anything to do with code stability? If not, I'll disable it and crack on.

Thanks for the reply. Pete

Stone Preston
Stone Preston
42,016 Points

you set breakpoints yourself, its not an indication that somethings wrong with your code (unless its an exception breakpoint, but thats not the case here.). You set breakpoints by double clicking in the gutter of xcode. This is very easy to do on accident and is what most likely happened. So just disable/remove the breakpoint and try running again

Peter O'Brien
Peter O'Brien
9,348 Points

Ah, that definitely could have happened. Thanks, Stone. Help much appreciated on a Sunday night. :-)