-3

每次我为 UITextField 创建一个插座时,它都会破坏我的应用程序。没有构建错误,只是在启动时终止。

"2015-11-27 17:34:19.005 ticTacToe[3540:71629] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ViewController 0x7fbb82682450> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key wins.'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010d8b0c65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010c003bb7 objc_exception_throw + 45
    2   CoreFoundation                      0x000000010d8b08a9 -[NSException raise] + 9
    3   Foundation                          0x000000010bb99b53 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259
    4   CoreFoundation                      0x000000010d7f8d50 -[NSArray makeObjectsPerformSelector:] + 224
    5   UIKit                               0x000000010c51d4eb -[UINib instantiateWithOwner:options:] + 1506
    6   UIKit                               0x000000010c3756d8 -[UIViewController _loadViewFromNibNamed:bundle:] + 242
    7   UIKit                               0x000000010c375cc8 -[UIViewController loadView] + 109
    8   UIKit                               0x000000010c375f39 -[UIViewController loadViewIfRequired] + 75
    9   UIKit                               0x000000010c3763ce -[UIViewController view] + 27
    10  UIKit                               0x000000010c291289 -[UIWindow addRootViewControllerViewIfPossible] + 58
    11  UIKit                               0x000000010c29164f -[UIWindow _setHidden:forced:] + 247
    12  UIKit                               0x000000010c29dde1 -[UIWindow makeKeyAndVisible] + 42
    13  UIKit                               0x000000010c241417 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2732
    14  UIKit                               0x000000010c24419e -[UIApplication _runWithMainScene:transitionContext:completion:] + 1349
    15  UIKit                               0x000000010c243095 -[UIApplication workspaceDidEndTransaction:] + 179
    16  FrontBoardServices                  0x0000000111bc95e5 __31-[FBSSerialQueue performAsync:]_block_invoke_2 + 21
    17  CoreFoundation                      0x000000010d7e441c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    18  CoreFoundation                      0x000000010d7da165 __CFRunLoopDoBlocks + 341
    19  CoreFoundation                      0x000000010d7d9f25 __CFRunLoopRun + 2389
    20  CoreFoundation                      0x000000010d7d9366 CFRunLoopRunSpecific + 470
    21  UIKit                               0x000000010c242b02 -[UIApplication _run] + 413
    22  UIKit                               0x000000010c2458c0 UIApplicationMain + 1282
    23  ticTacToe                           0x000000010b6f386f main + 111
    24  libdyld.dylib                       0x000000010eaac145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException"

如果可能的话,请在我编程迟缓时直观地解释修复:-)

4

1 回答 1

0

除了 Hayden 的回答 - 您可以通过查看 Xcode 中的边距(如下所示)轻松检查您认为应该连接到视图控制器的任何 IBOutlets 是否实际上未连接。每个 IBOutlet 都会显示一个实心圆圈,表明它已连接到情节提要上的元素。

如果圆圈为空,则表示未连接,这可能导致崩溃...

在此处输入图像描述

于 2015-11-27T18:15:18.463 回答