出现Terminating app due to uncaught exception 'NSUnknownKeyException', reason: 错误的解决方法

原创 2015年11月20日 00:07:19

在编译成功但是运行时出现以下错误:

2015-11-19 23:48:27.593 BtnLabelText[1403:85125] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<BtnLabelText.ViewController 0x7f9b204473a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key clickMe.'
*** First throw call stack:
(
0   CoreFoundation                      0x000000010acdbf45 __exceptionPreprocess + 165
1   libobjc.A.dylib                     0x000000010ca02deb objc_exception_throw + 48
2   CoreFoundation                      0x000000010acdbb89 -[NSException raise] + 9
3   Foundation                          0x000000010b0a5a6b -[NSObject(NSKeyValueCoding) setValue:forKey:] + 288
4   UIKit                               0x000000010b68504c -[UIViewController setValue:forKey:] + 88
5   UIKit                               0x000000010b8b2a71 -[UIRuntimeOutletConnection connect] + 109
6   CoreFoundation                      0x000000010ac1ca80 -[NSArray makeObjectsPerformSelector:] + 224
7   UIKit                               0x000000010b8b1454 -[UINib instantiateWithOwner:options:] + 1864
8   UIKit                               0x000000010b68bc16 -[UIViewController _loadViewFromNibNamed:bundle:] + 381
9   UIKit                               0x000000010b68c542 -[UIViewController loadView] + 178
10  UIKit                               0x000000010b68c8a0 -[UIViewController loadViewIfRequired] + 138
11  UIKit                               0x000000010b68d013 -[UIViewController view] + 27
12  UIKit                               0x000000010b56651c -[UIWindow addRootViewControllerViewIfPossible] + 61
13  UIKit                               0x000000010b566c05 -[UIWindow _setHidden:forced:] + 282
14  UIKit                               0x000000010b5784a5 -[UIWindow makeKeyAndVisible] + 42
15  UIKit                               0x000000010b4f2396 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4131
16  UIKit                               0x000000010b4f89c3 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1750
17  UIKit                               0x000000010b4f5ba3 -[UIApplication workspaceDidEndTransaction:] + 188
18  FrontBoardServices                  0x000000010e8c3784 -[FBSSerialQueue _performNext] + 192
19  FrontBoardServices                  0x000000010e8c3af2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
20  CoreFoundation                      0x000000010ac08011 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
21  CoreFoundation                      0x000000010abfdf3c __CFRunLoopDoSources0 + 556
22  CoreFoundation                      0x000000010abfd3f3 __CFRunLoopRun + 867
23  CoreFoundation                      0x000000010abfce08 CFRunLoopRunSpecific + 488
24  UIKit                               0x000000010b4f54f5 -[UIApplication _run] + 402
25  UIKit                               0x000000010b4fa30d UIApplicationMain + 171
26  BtnLabelText                        0x000000010aafc51d main + 109
27  libdyld.dylib                       0x000000010d51192d start + 1
28  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException


出现这个的原因是:之前我为按钮添加了一个变量,但是在代码中又把这个变量给删除了,此时关联还在,所以在运行时找这个变量无法找到,所以会出现错误,那么此时就是选择这个变量所在的控件对象右键单击,在弹出的菜单中看是否还存在着关联,如果存在则将此关联删除,删除方法就是单击关联哪里的x号,如下图所示:


删除之后运行正常了


版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ViewController 0x19862

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[

Terminating app due to uncaught exception 'NSUnknownKeyException'

问题:  Control Fun[3929:60b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', re...
  • gogler
  • gogler
  • 2014年05月24日 21:00
  • 14287

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<DataModel 0x7fe44b

self.model=[[DataModel alloc]init];     [self.model setValue:@"searph" forKey:@"stockName"];     [...

Xcode出现警告:Terminating app due to uncaught exception 'NSUnknownKeyException'的解决方法

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefi...

取到字符串的指定下标的字符

这个也是非常简单 characterAtIndex int main(int argc, const char * argv[]) { NSString *str = @"中国 I LOVE ...
  • yi_zz32
  • yi_zz32
  • 2015年09月27日 21:28
  • 5276

iOS coretext框架第二章 CTStringAttributes类介绍

coretext框架的这个类是为了定义 设置在CFAttributedString中的所有文字属性 字符属性名称: 1.const CFStringRef kCTFontAttributeNam...

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<YHTargetTableViewCell

iOS开发使用StoryBoard拖的控件报这个错:Terminating app due to uncaught exception 'NSUnknownKeyException', reason:...

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFArra

这个错误说的是一个不可变数组负值给了一个可变的数组。yo

Terminating app due to uncaught execption'NSUnknownKeyException'的解决方式

Terminating app due to uncaught exception ‘NSUnknownKeyException’, reason: ‘[ setValue:forUndefinedK...

windows 下安装部分gem时出现 Could not create Makefile due to some reason 的解决办法

现象描述: 如果你安装某个需要本地编译代码的gem 时出现了类似如下的错误,则符合本文章所谈论的情况: C:/Develop/Ruby193/bin/ruby.exe extconf.rb ch...
  • woncomp
  • woncomp
  • 2013年04月11日 09:21
  • 1711
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:出现Terminating app due to uncaught exception 'NSUnknownKeyException', reason: 错误的解决方法
举报原因:
原因补充:

(最多只允许输入30个字)