this class is not key value coding-compliant for the key...

I am a complete beginner. I took some code from tutorials. I have a project about adding notes, saving them, deleting them, attaching images and more. When I run the app, I get this error next to @main in the AppDelegate file.

Thread 1: "[<App.NewNoteViewController 0x12f310680> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key saveNotes."

The view controller file code is

import UIKit



class NewNoteViewController: UIViewController {



    @IBOutlet weak var deleteNote: UIBarButtonItem!

    @IBOutlet weak var saveNote: UIBarButtonItem!

    @IBOutlet weak var attachNotes: UIBarButtonItem!


    override func viewDidLoad() {

        super.viewDidLoad()

        // Do any additional setup after loading the view.

    }

   
    /*

    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {

        // Get the new view controller using segue.destination.

        // Pass the selected object to the new view controller.

    }

    */
}

I fixed all the storyboard perfectly. Please help.

The error shows at main, but that is not where the error originates.

A possible reason is that an IBOutlet connection is missing or corrupted. You should disconnect, reconnect and do a clean Build Folder.

The error message means the storyboard is looking for an outlet named saveNotes but your code shows that the outlet is named saveNote.

You have probably changed some name from saveNotes to saveNote in code and not rebuilt the connection.

When you change a name of object, it is usually safer to use right-click > Refactor > Rename on the object name.

So, disconnect saveNote form storyboard and reconnect to its IBOutlet. Do a Clean Build folder after, in case.

this class is not key value coding-compliant for the key...
 
 
Q