Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Josh Schlabach
1,771 PointsApp Crashes Immediately When Button Is Pressed
I followed everything that Pasan did in the video, and I get an error when I press the button. Anyone help?

Josh Schlabach
1,771 PointsMy code:
<p> import UIKit
class ViewController: UIViewController {
@IBOutlet weak var aButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
aButton.setTitle("Press me!", forState: .Normal) }
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func buttonPressed() {
view.backgroundColor = UIColor.orangeColor()
}
} </p>
The error: (lldb)
1 Answer

Kamil Manafov
4,665 Pointsfatal error: unexpectedly found nil while unwrapping an Optional value
remember optional String on that constructor
Dan Oswalt
23,438 PointsDan Oswalt
23,438 PointsPlease share the code and the error.