-3

Everytime I create an outlet for a UITextField it breaks my app. No build errors just termination at boot.

"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"

If possible please explain fix visually as I am programming retarded :-)

rmaddy
  • 314,917
  • 42
  • 532
  • 579
MANICX100
  • 1,299
  • 2
  • 12
  • 20
  • You might have an outlet in your storyboard that isn't connected to any code (You added it and removed it, or deleted a variable in the code). On the left panel in storyboard, right click all of your view controllers and make sure everything is connected to an IBOutlet or IBAction in your code – Hayden Holligan Nov 27 '15 at 17:56
  • show the code related to textfield – Teja Nandamuri Nov 27 '15 at 18:05
  • Always do some searching on the error before posting a question. – rmaddy Nov 27 '15 at 18:20

1 Answers1

0

Further to Hayden's answer - you can easily check to see if any IBOutlets which you think should be connected to your View Controller are actually not connected by looking at the margin in Xcode (as below). Each IBOutlet will display a filled in circle showing you that it's connected to an element on the storyboard.

If the circle is empty it's not connected which can cause a crash...

enter image description here

Andrew Lombard
  • 419
  • 4
  • 18