I am recieaving a "Class is not key value coding-compliant" error concerning multiple UI objects within my Xcode project despite being correctly linked up with their corresponding variable within their view controllers.
I suspected it had something to do with the project file itself experiencing a bug but when I transfer all my code and view controllers to a new project the error continued to appear.
For example, within one view controller I am attempting to create a password login page, however when I enter the page within the simulator it crashes and presents the following error in the AppDelegate next to @main
class EviPasswordVC: UIViewController {
@IBOutlet weak var txtPassword: UITextField!
@IBOutlet weak var LabError: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func btnEnter(_ sender: UIButton) {
if txtPassword.text == "1234" {
LabError.text = "Success"
performSegue(withIdentifier: "gotoEvidence(Menu)", sender: self)}
//If the text entered into 'txtPassword' = 1234, 'LabError' will display "Success' and the next page will be shown.
else {
LabError.text = "Failed"}
//If the text entered into 'txtPassword' does not equal '1234', 'LabError will display "Failed"
}
}
Thread 1: "[<UIViewController 0x7fa417a1f180> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key LabError."
This error continued to persist even when I ensured the label had the variable name 'LabError' within my view controller. This code use to work, however when I started organising these sections of code under different classes corresponding to different view controllers errors like this started to occur, even when I reverted back to their orginal position under the same class and view controller.
If anyone knows the possible cause for this error and any way to resolve it can they please respond, it would be extremely appreicated.
Thanks.