I am trying to make an app that will ask questions and you have to answer True or False. This is part of an online course I am taking. I started with the challenge of displaying on the screen " four + two is equal to 6" and displaying it. Here is the code I wrote in order to display that.
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var questionLabel: UILabel!
@IBOutlet weak var optionBar: UIProgressView!
@IBOutlet weak var trueButton: UIButton!
@IBOutlet weak var falseButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
questionLabel.text = "Four + two is equal to 6"
}
@IBAction func answerButtonPressed(_ sender: UIButton) {
}
}
When I try to run the simulator, I get the error:
terminating with uncaught exception of type NSException
and it brings me to my appDelegate screen and shows the error:
Exception: "[<Quizzler_iOS13.ViewController 0x7f9b90608020> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key question.
on line 3. Here is the code:
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
Do any of you guys know how to fix this?