I have a very simple execution, but it's crashing for some reason. Any ideas why?
import UIKit
class ViewController: UIViewController {
@IBOutlet var myTextField: UITextField!
@IBOutlet var resultsLabel: UILabel!
@IBAction func pressButton(sender: AnyObject) {
let diceRoll = String(arc4random_uniform(UInt32(6)))
print(diceRoll)
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
Crash Log added
2016-02-06 16:24:32.358 GuessingGame[6330:496415] * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key TextField.' * First throw call stack: ( 0 CoreFoundation 0x000000010960ae65 exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010b34adeb objc_exception_throw + 48 2 CoreFoundation 0x000000010960aaa9 -[NSException raise] + 9 3 Foundation 0x00000001099d39bb -[NSObject(NSKeyValueCoding) setValue:forKey:] + 288 4 UIKit 0x0000000109fb6320 -[UIViewController setValue:forKey:] + 88 5 UIKit 0x000000010a1e4f41 -[UIRuntimeOutletConnection connect] + 109 6 CoreFoundation 0x000000010954b4a0 -[NSArray makeObjectsPerformSelector:] + 224 7 UIKit 0x000000010a1e3924 -[UINib instantiateWithOwner:options:] + 1864 8 UIKit 0x0000000109fbceea -[UIViewController _loadViewFromNibNamed:bundle:] + 381 9 UIKit 0x0000000109fbd816 -[UIViewController loadView] + 178 10 UIKit 0x0000000109fbdb74 -[UIViewController loadViewIfRequired] + 138 11 UIKit 0x0000000109fbe2e7 -[UIViewController view] + 27 12 UIKit 0x0000000109e94ab0 -[UIWindow addRootViewControllerViewIfPossible] + 61 13 UIKit 0x0000000109e95199 -[UIWindow _setHidden:forced:] + 282 14 UIKit 0x0000000109ea6c2e -[UIWindow makeKeyAndVisible] + 42 15 UIKit 0x0000000109e1f663 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4131 16 UIKit 0x0000000109e25cc6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1760 17 UIKit 0x0000000109e22e7b -[UIApplication workspaceDidEndTransaction:] + 188 18 FrontBoardServices 0x000000010d1df754 -[FBSSerialQueue _performNext] + 192 19 FrontBoardServices 0x000000010d1dfac2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45 20 CoreFoundation 0x0000000109536a31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 21 CoreFoundation 0x000000010952c95c __CFRunLoopDoSources0 + 556 22 CoreFoundation 0x000000010952be13 __CFRunLoopRun + 867 23 CoreFoundation 0x000000010952b828 CFRunLoopRunSpecific + 488 24 UIKit 0x0000000109e227cd -[UIApplication _run] + 402 25 UIKit 0x0000000109e27610 UIApplicationMain + 171 26 GuessingGame 0x000000010942b4dd main + 109 27 libdyld.dylib 0x000000010be5392d start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)