抱歉,我没有具体问题,但我不知道如何解决这个错误。该应用程序本身在 Xcode 中没有显示任何错误,但它在开始时崩溃并显示错误消息this class is not key value coding-compliant for the key guessMade.
@IBOutlet weak var numberGuessed: UITextField!
@IBOutlet weak var answer: UILabel!
@IBAction func guessMade(sender: AnyObject) {
var numberOfFingers = arc4random_uniform(11)
var numberString = String(numberOfFingers)
var integerGuessed = numberGuessed.text
if numberString == integerGuessed {
self.answer.text = "You're right! I had \(integerGuessed) fingers up"
}else {
self.answer.text = "Nope! I had \(numberString) fingers up"
}
}
这是一个非常小的项目,所以这是整个代码。该按钮guessMade
应该检查文本字段中输入的数字是否与按下按钮时随机生成的数字相匹配。任何想法错误告诉我错了什么?