Xcode线程1:SIGABRT:未捕获的异常'NSUnknownKeyException'

时间:2015-07-12 17:51:43

标签: ios xcode

我是编码和Xcode的新手。我所面临的问题在标题中说明。我希望任何人都可以帮助我。

错误消息将粘贴在下面

2015-07-13 01:11:36.443 Main_Iphone 6[2570:94488] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Main_Iphone_6.ViewController 0x7fccc8432560> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key Button.'

首先抛出调用堆栈:

(
0   CoreFoundation                      0x0000000100c02c65 __exceptionPreprocess + 165
1   libobjc.A.dylib                     0x000000010276dbb7 objc_exception_throw + 45
2   CoreFoundation                      0x0000000100c028a9 -[NSException raise] + 9
3   Foundation                          0x0000000101020b53 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259
4   CoreFoundation                      0x0000000100b4ad50 -[NSArray makeObjectsPerformSelector:] + 224
5   UIKit                               0x00000001017794eb -[UINib instantiateWithOwner:options:] + 1506
6   UIKit                               0x00000001015d16d8 -[UIViewController _loadViewFromNibNamed:bundle:] + 242
7   UIKit                               0x00000001015d1cc8 -[UIViewController loadView] + 109
8   UIKit                               0x00000001015d1f39 -[UIViewController loadViewIfRequired] + 75
9   UIKit                               0x00000001015d23ce -[UIViewController view] + 27
10  UIKit                               0x00000001014ed289 -[UIWindow addRootViewControllerViewIfPossible] + 58
11  UIKit                               0x00000001014ed64f -[UIWindow _setHidden:forced:] + 247
12  UIKit                               0x00000001014f9de1 -[UIWindow makeKeyAndVisible] + 42
13  UIKit                               0x000000010149d417 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2732
14  UIKit                               0x00000001014a019e -[UIApplication _runWithMainScene:transitionContext:completion:] + 1349
15  UIKit                               0x000000010149f095 -[UIApplication workspaceDidEndTransaction:] + 179
16  FrontBoardServices                  0x000000010426a5e5 __31-[FBSSerialQueue performAsync:]_block_invoke_2 + 21
17  CoreFoundation                      0x0000000100b3641c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
18  CoreFoundation                      0x0000000100b2c165 __CFRunLoopDoBlocks + 341
19  CoreFoundation                      0x0000000100b2bf25 __CFRunLoopRun + 2389
20  CoreFoundation                      0x0000000100b2b366 CFRunLoopRunSpecific + 470
21  UIKit                               0x000000010149eb02 -[UIApplication _run] + 413
22  UIKit                               0x00000001014a18c0 UIApplicationMain + 1282
23  Main_Iphone 6                       0x0000000100a101d7 main + 135
24  libdyld.dylib                       0x0000000102ea3145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

2 个答案:

答案 0 :(得分:1)

你在故事板或xib文件中定义了一个名为<textarea ng-model-options="{ updateOn: 'blur'}" ng-model="value.note"></textarea> 的插座,但你连接它的东西没有同名的属性。您已从代码中删除了Button,或者您未在界面构建器中的身份检查器中设置正确的视图控制器类。

答案 1 :(得分:0)

最重要的信息是此类不是键值按键编码兼容。

从回溯中可以看出,在实例化UINib之后

[UINib instantiateWithOwner:options:]

有一个方法发送到数组的所有对象

[NSArray makeObjectsPerformSelector:]

设置属性Button

的值
[NSObject(NSKeyValueCoding) setValue:forKey:]

此属性必须合成或具有明确的setter和getter才能符合键值编码。

设置异常断点以查找崩溃的确切位置,并查看模型类中缺少的属性Button