在swift中选择表格菜单项时,应用程序崩溃

时间:2017-02-08 17:43:52

标签: swift xcode error-handling

当在幻灯片菜单上按下一个项目(使用表视图创建)时,应用程序在模拟器中崩溃,我尝试删除UI和IB之间的连接并重新构建它们,这是问题,但它没有&# 39;解决了它。

这是出现的错误代码:

View Controller is : <AKSwiftSlideMenu.HomeVC: 0x7fa6c5e05b90> 
Calculate your own repayment
2017-02-08 17:36:13.782 AKSwiftSlideMenu[37086:3161182] Unknown class     TrackerVC in Interface Builder file.
2017-02-08 17:36:13.801 AKSwiftSlideMenu[37086:3161182] *** Terminating     app due to uncaught exception 'NSUnknownKeyException', reason:     '[<UIViewController 0x7fa6c5d1f920> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key AnnualInterestInput.'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010a9a0d4b     __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x000000010a40221e objc_exception_throw + 48
    2   CoreFoundation                      0x000000010a9a0c99 -[NSException raise] + 9
    3   Foundation                          0x0000000109f109df -[NSObject(NSKeyValueCoding) setValue:forKey:] + 291
4   UIKit                               0x000000010af5f293 -[UIViewController setValue:forKey:] + 88
5   UIKit                               0x000000010b1d379e -[UIRuntimeOutletConnection connect] + 109
6   CoreFoundation                      0x000000010a9459e0 -[NSArray makeObjectsPerformSelector:] + 256
7   UIKit                               0x000000010b1d2122 -[UINib instantiateWithOwner:options:] + 1867
8   UIKit                               0x000000010af659c5 -[UIViewController _loadViewFromNibNamed:bundle:] + 386
9   UIKit                               0x000000010af662e7 -[UIViewController loadView] + 177
10  UIKit                               0x000000010af6661c -[UIViewController loadViewIfRequired] + 201
11  UIKit                               0x000000010af6d062 -[UIViewController __viewWillAppear:] + 118
12  UIKit                               0x000000010af981d3 -[UINavigationController _startCustomTransition:] + 1290
13  UIKit                               0x000000010afa8e48 -[UINavigationController _startDeferredTransitionIfNeeded:] + 697
14  UIKit                               0x000000010afa9fdb -[UINavigationController __viewWillLayoutSubviews] + 58
15  UIKit                               0x000000010b1a0dd7 -[UILayoutContainerView layoutSubviews] + 223
16  UIKit                               0x000000010ae89ab8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1237
17  QuartzCore                          0x000000010f85fbf8 -[CALayer layoutSublayers] + 146
18  QuartzCore                          0x000000010f853440 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
19  QuartzCore                          0x000000010f8532be _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
20  QuartzCore                          0x000000010f7e1318 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280
21  QuartzCore                          0x000000010f80e3ff _ZN2CA11Transaction6commitEv + 475
22  UIKit                               0x000000010adef7f0 _afterCACommitHandler + 346
23  CoreFoundation                      0x000000010a945267 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
24  CoreFoundation                      0x000000010a9451d7 __CFRunLoopDoObservers + 391
25  CoreFoundation                      0x000000010a929f8e __CFRunLoopRun + 1198
26  CoreFoundation                      0x000000010a929884 CFRunLoopRunSpecific + 420
27  GraphicsServices                    0x000000010f02fa6f GSEventRunModal + 161
28  UIKit                               0x000000010adc4c68 UIApplicationMain + 159
29  AKSwiftSlideMenu                    0x0000000109e0401f main + 111
30  libdyld.dylib                       0x000000010e09f68d start + 1
31  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

1 个答案:

答案 0 :(得分:0)

根据错误,很可能是您的某个视图已连接到已从类中删除的名为AnnualInterestInput的插座。

如果通过删除所有插座并将它们重新连接到视图控制器并没有解决,那么可能是由于xib中的类错误。

这意味着您在xib或storyboard中设置了错误的类,但它无法找到密钥。如果课程仍然正确,请检查模块是否正确!

这条线让我暗示这可能是问题:

2017-02-08 17:36:13.782 AKSwiftSlideMenu[37086:3161182] Unknown class TrackerVC in Interface Builder file.