ios - 由于 ios 中未捕获的异常 'NSUnknownKeyException' 而终止应用程序

标签 ios iphone xcode ios7

<分区>

我的应用因 NSUnknownKeyException 而崩溃。我不知道为什么会发生这种崩溃

我的崩溃报告是

Terminating app due to uncaught exception 'NSUnknownKeyException', reason:   
'[<TransactionsViewController 0x8a6bbe0> setValue:forUndefinedKey:]: this class is not
key value coding-compliant for the key sidebarButton.'

*** First throw call stack:
(
0   CoreFoundation                      0x017615e4 __exceptionPreprocess + 180
1   libobjc.A.dylib                     0x014e48b6 objc_exception_throw + 44
2   CoreFoundation                      0x017f16a1 -[NSException raise] + 17
3   Foundation                          0x011a59ee -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
4   Foundation                          0x01111cfb _NSSetUsingKeyValueSetter + 88
5   Foundation                          0x01111253 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
6   Foundation                          0x0117370a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
7   UIKit                               0x004f4a15 -[UIRuntimeOutletConnection connect] + 106
8   libobjc.A.dylib                     0x014f67d2 -[NSObject performSelector:] + 62
9   CoreFoundation                      0x0175cb6a -[NSArray makeObjectsPerformSelector:] + 314
10  UIKit                               0x004f356e -[UINib instantiateWithOwner:options:] + 1417
11  UIKit                               0x00786a2f -[UIStoryboard instantiateViewControllerWithIdentifier:] + 220
12  UIKit                               0x00787028 -[UIStoryboardSegueTemplate _perform:] + 88
13  UIKit                               0x007870f9 -[UIStoryboardSegueTemplate perform:] + 115
14  libobjc.A.dylib                     0x014f6874 -[NSObject performSelector:withObject:withObject:] + 77
15  UIKit                               0x002540c2 -[UIApplication sendAction:to:from:forEvent:] + 108
16  UIKit                               0x0025404e -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
17  UIKit                               0x0034c0c1 -[UIControl sendAction:to:forEvent:] + 66
18  UIKit                               0x0034c484 -[UIControl _sendActionsForEvents:withEvent:] + 577
19  UIKit                               0x0034b733 -[UIControl touchesEnded:withEvent:] + 641
20  UIKit                               0x0029151d -[UIWindow _sendTouchesForEvent:] + 852
21  UIKit                               0x00292184 -[UIWindow sendEvent:] + 1232
22  UIKit                               0x00265e86 -[UIApplication sendEvent:] + 242
23  UIKit                               0x0025018f _UIApplicationHandleEventQueue + 11421
24  CoreFoundation                      0x016ea83f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
25  CoreFoundation                      0x016ea1cb __CFRunLoopDoSources0 + 235
26  CoreFoundation                      0x0170729e __CFRunLoopRun + 910
27  CoreFoundation                      0x01706ac3 CFRunLoopRunSpecific + 467
28  CoreFoundation                      0x017068db CFRunLoopRunInMode + 123
29  GraphicsServices                    0x037069e2 GSEventRunModal + 192
30  GraphicsServices                    0x03706809 GSEventRun + 104
31  UIKit                               0x00252d3b UIApplicationMain + 1225
32  FortabBar                           0x000049ad main + 141
33  libdyld.dylib                       0x01d9f70d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

谁能帮我解决这个问题

最佳答案

您已将 Interface Builder 中的某些东西(大概是 UIButton)连接到名称为 sidebarButton 的 TransactionsViewController,但是 TransactionsViewController 没有具有该名称的导出。您需要在 TransactionsViewController 类中声明导出:

@property (nonatomic, weak) IBOutlet UIButton *sidebarButton;

或者您需要在 Interface Builder 中删除该连接。

关于ios - 由于 ios 中未捕获的异常 'NSUnknownKeyException' 而终止应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21396366/

相关文章:

ios - 恢复购买工作,但它不断循环

iphone - UINavigationController 栈

ios - 重试 RACObserve 直到成功

ios - Xcode 核心数据创建 NSManagedObject 子类创建一个额外的导入语句

ios - 如何在 Alamofire 中将响应值保存到 NSDictionary 中?

ios - 解析 XML 时如何获取特定元素?

iphone - 检测手指是否握住物体

ios - 带有 CollectionView 和文本行的 TableView 部分

ios - 在 IOS 中使用 Storyboard Identifier 实例化 ViewController

iphone - 如何注册应用程序以响应自定义 URL 方案打开请求?