I know there are similar questions out there and I have looked at them but I can't seem to solve the problem. I'm actually working on this project here that Apple uses to help users learn Xcode: https://developer.apple.com/library/content/referencelibrary/GettingStarted/DevelopiOSAppsSwift/ConnectTheUIToCode.html#//apple_ref/doc/uid/TP40015214-CH22-SW1
This is my ViewController.swift code:
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.
}
//MARK: Actions
@IBAction func setDefaultLabelText(_ sender: UIButton) {
mealNameLabel.text = "Default Text"
}
}
I keep getting this error even when I follow all of the steps:
2017-10-14 16:18:49.195098-0400 FoodTracker[1946:46609] [MC] Lazy loading
NSBundle MobileCoreServices.framework
2017-10-14 16:18:49.195968-0400 FoodTracker[1946:46609] [MC] Loaded
MobileCoreServices.framework
2017-10-14 16:18:49.211086-0400 FoodTracker[1946:46609] [MC] System group
container for systemgroup.com.apple.configurationprofiles path is
/Users/xcodeclub/Library/Developer/CoreSimulator/Devices/54569EE9-2F14-41C6-
94D7-EDB605459B46/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-10-14 16:18:49.221000-0400 FoodTracker[1946:46609] *** Terminating app
due to uncaught exception 'NSUnknownKeyException', reason:
'[<FoodTracker.ViewController 0x7fc93bf08b80> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key setDefaultLabelText.'
Anybody care to help?