I am trying to learn iOS app development in Swift following this developer.apple tutorial but am getting lost. I am a moderately experienced coder (without any experience with GUI) but I think I am being confused by the Xcode interface.
I am trying to test the following extremely simple app that I've built following the above tutorial
//
// ViewController.swift
// test
//
// Created by Remi on 2017-07-29.
// Copyright © 2017 Remi. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
//MARK: Properties
@IBOutlet weak var nameTextField: UITextField!
@IBOutlet weak var mealNameLabel: UILabel!
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.
}
//MARK: Actions
@IBAction func setDefaultLabelText(sender: UIButton) {
mealNameLabel.text = "Default Text"
}
}
When I run this code I get an error signal SIGABRT
at the lign class AppDelegate: UIResponder, UIApplicationDelegate {
of AppDelegate.swift
Here is the output on the console
2017-07-31 09:15:56.334 test[78397:35616616] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<test.ViewController 0x7fdf1bb0f770> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key setDefaultLabelText.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010fd26e65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000111a66deb objc_exception_throw + 48
2 CoreFoundation 0x000000010fd26aa9 -[NSException raise] + 9
3 Foundation 0x00000001100ef9bb -[NSObject(NSKeyValueCoding) setValue:forKey:] + 288
4 UIKit 0x00000001106d2320 -[UIViewController setValue:forKey:] + 88
5 UIKit 0x0000000110900f41 -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x000000010fc674a0 -[NSArray makeObjectsPerformSelector:] + 224
7 UIKit 0x00000001108ff924 -[UINib instantiateWithOwner:options:] + 1864
8 UIKit 0x00000001106d8eea -[UIViewController _loadViewFromNibNamed:bundle:] + 381
9 UIKit 0x00000001106d9816 -[UIViewController loadView] + 178
10 UIKit 0x00000001106d9b74 -[UIViewController loadViewIfRequired] + 138
11 UIKit 0x00000001106da2e7 -[UIViewController view] + 27
12 UIKit 0x00000001105b0ab0 -[UIWindow addRootViewControllerViewIfPossible] + 61
13 UIKit 0x00000001105b1199 -[UIWindow _setHidden:forced:] + 282
14 UIKit 0x00000001105c2c2e -[UIWindow makeKeyAndVisible] + 42
15 UIKit 0x000000011053b663 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4131
16 UIKit 0x0000000110541cc6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1760
17 UIKit 0x000000011053ee7b -[UIApplication workspaceDidEndTransaction:] + 188
18 FrontBoardServices 0x00000001138fb754 -[FBSSerialQueue _performNext] + 192
19 FrontBoardServices 0x00000001138fbac2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
20 CoreFoundation 0x000000010fc52a31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
21 CoreFoundation 0x000000010fc4895c __CFRunLoopDoSources0 + 556
22 CoreFoundation 0x000000010fc47e13 __CFRunLoopRun + 867
23 CoreFoundation 0x000000010fc47828 CFRunLoopRunSpecific + 488
24 UIKit 0x000000011053e7cd -[UIApplication _run] + 402
25 UIKit 0x0000000110543610 UIApplicationMain + 171
26 test 0x000000010fb4846d main + 109
27 libdyld.dylib 0x000000011256f92d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Can you help me out understand what is going on here?
I am using Xcode Version 7.2.1