首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NSUnknownKeyException?为什么?

NSUnknownKeyException?为什么?
EN

Stack Overflow用户
提问于 2016-02-10 01:27:46
回答 1查看 59关注 0票数 0

我已经在Xcode7中尝试了很多次,但仍然存在以下问题:

代码语言:javascript
复制
TapWar[10487:391936] *** Terminating app due to uncaught exception 'NSUnknownKeyException', 
reason: '[<TapWar.ViewController 0x7f9848483220> setValue:forUndefinedKey:]: 
this class is not key value coding-compliant for the key buttomButtonAction.'

代码没有什么特别之处,只是情节串连板的插座和动作导入了UIKit

代码语言:javascript
复制
class ViewController: UIViewController {


    @IBOutlet weak var topButton: UIButton!
    @IBOutlet weak var buttomButton: UIButton!
    @IBOutlet weak var topLabel: UILabel!
    @IBOutlet weak var buttomLabel: UILabel!


    override func viewDidLoad() {
        super.viewDidLoad()
    score = 0

    topLabel.text = "\(score)"
    buttomLabel.text = "\(score)"

    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
//Button on top to tap
    @IBAction func topButtonAction(sender: UIButton) 

    }
//Button under to tap
    @IBAction func buttomButtonAction(sender: AnyObject) {

    }
}
EN

回答 1

Stack Overflow用户

发布于 2016-02-10 09:22:21

你检查过你的IBOutlet或IBAction连接了吗?该错误通常会导致名称不一致。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35298352

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档