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
Nat Rogers
7,433 PointsFollowing along, but my app doesn't work!
Here is the code I have in the ViewController Class:
class ViewController: UIViewController {
@IBOutlet weak var funFactLabelOne: UILabel!
let facts = ["Fact", "New Fact", "New New Fact"]
override func viewDidLoad() {
super.viewDidLoad()
funFactLabelOne.text = facts[0]
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func showFunFact() {
funFactLabelOne.text = facts[1]
}
}
When I run the code in the iPhone simulator, when I click the button, the app crashes and the output section of the debugger says "lldb". I am at a loss.
3 Answers
Taylor Amsler
4,427 PointsHi Nat, new to this also, but I tested a bit and (assuming you hooked up everything properly) your code looks fine.
However, you may have accidentally added a breakpoint. In Xcode hit the keys: command+7. Alternatively, go to the navigator menu (left side of screen) and go to the icon second from the right.
Delete any breakpoints you find there and let me know if that solved the problem. If it didn't you may be having issues with optionals/calling something that doesn't exist. Thanks.
Nat Rogers
7,433 Pointsthanks Taylor. that was the issue. not sure how i managed to add one of those...
Taylor Amsler
4,427 PointsNo problem. Just for the future, you add one by clicking the gutter in your source code. I add them accidentally all the time :)
They are useful for debugging though if you don't know where the code is messing up. You can break your program into chunks and see where things are going wrong.
Happy coding.