Xcode线程1:信号SIGABRT

时间:2014-12-30 01:57:55

标签: xcode swift

由于此错误有所不同,我不确定是什么问题

console error message:
 *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Pitch_Perfect.PlaySoundsViewController 0x7f8b82e13830> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key test.'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000109ab83f5 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010b5e6bb7 objc_exception_throw + 45
    2   CoreFoundation                      0x0000000109ab8039 -[NSException raise] + 9
    3   Foundation                          0x0000000109ecf4d3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259
    4   CoreFoundation                      0x0000000109a02400 -[NSArray makeObjectsPerformSelector:] + 224
    5   UIKit                               0x000000010a60597d -[UINib instantiateWithOwner:options:] + 1506
    6   UIKit                               0x000000010a466698 -[UIViewController _loadViewFromNibNamed:bundle:] + 242
    7   UIKit                               0x000000010a466c88 -[UIViewController loadView] + 109
    8   UIKit                               0x000000010a466ef9 -[UIViewController loadViewIfRequired] + 75
    9   UIKit                               0x000000010a46738e -[UIViewController view] + 27
    10  UIKit                               0x000000010a48aa77 -[UINavigationController _startCustomTransition:] + 633
    11  UIKit                               0x000000010a49696e -[UINavigationController _startDeferredTransitionIfNeeded:] + 386
    12  UIKit                               0x000000010a4974b7 -[UINavigationController __viewWillLayoutSubviews] + 43
    13  UIKit                               0x000000010a5db399 -[UILayoutContainerView layoutSubviews] + 202
    14  UIKit                               0x000000010a3bb199 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 521
    15  QuartzCore                          0x000000010d3c6f98 -[CALayer layoutSublayers] + 150
    16  QuartzCore                          0x000000010d3bbbbe _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
    17  QuartzCore                          0x000000010d3bba2e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
    18  QuartzCore                          0x000000010d329ade _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
    19  QuartzCore                          0x000000010d32abea _ZN2CA11Transaction6commitEv + 390
    20  UIKit                               0x000000010a33f27d _UIApplicationHandleEventQueue + 2035
    21  CoreFoundation                      0x00000001099edad1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    22  CoreFoundation                      0x00000001099e399d __CFRunLoopDoSources0 + 269
    23  CoreFoundation                      0x00000001099e2fd4 __CFRunLoopRun + 868
    24  CoreFoundation                      0x00000001099e2a06 CFRunLoopRunSpecific + 470
    25  GraphicsServices                    0x000000010da659f0 GSEventRunModal + 161
    26  UIKit                               0x000000010a342550 UIApplicationMain + 1282
    27  Pitch Perfect                       0x000000010957f7ce top_level_code + 78
    28  Pitch Perfect                       0x000000010957f80a main + 42
    29  libdyld.dylib                       0x000000010bdc0145 start + 1
    30  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

1 个答案:

答案 0 :(得分:1)

通常,这是因为您设置了一个插座然后删除了该属性。例如,假设您有一个名为test的商店:

IBOutlet UILabel* test;

或者:

@property (nonatomic, weak) IBOutlet UILabel* test;

让我们说你已经设置了这一切,包括你的界面中的标签(故事板)。但现在让我们说你删除那行代码。因此,这会使标签及其出口仍在您的笔尖中,尝试在代码中形成与名为test的ivar /属性的连接 - 并且该代码不再存在。因此,当nib加载并且无法形成连接时会崩溃。

这种错误就有变化。例如,您没有删除代码,但您更改了类的名称。但它有各种相同的东西 - 当笔尖加载时,你的笔尖中的插座名称和实际文件的所有者之间不匹配。