I am making my own app and I save a label and saving it by clicking the player1button and I then get it back in the view did load. The problem is that after I get it back it won't let me change it again and when I try to click the goalUp button it comes up with the error: "thread 1: EXC_BAD_INSTRUCTION". It says this error on the first line under viewDidLoad. Please help!
@IBOutlet var goal: UILabel!
@IBAction func player1button(sender: AnyObject) {
NSUserDefaults().setValue(goal.text!, forKey:"firstGoal")
}
var goal1 = 0
@IBAction func goalUp(sender: AnyObject) {
goal1++
goal.text = "\(goal1)"
}
override func viewDidLoad() {
super.viewDidLoad()
goal1 = Int((NSUserDefaults().objectForKey("firstGoal") as? String)!)!
goal.text = (NSUserDefaults().objectForKey("firstGoal") as? String)
}