CoreData class key error

Hey everyone,

I keep getting the “this class is not key value coding-compliant for the key xxx” error with my app when I press the addIntention button, which corresponds to the addIntention IBAction. I am unable to figure out what is wrong with it. Here is the Swift code, followed by a screenshot of the CoreData table:


import UIKit
import CoreData
var intentionsArray: [NSManagedObject] = []
class ViewController: UIViewController, UINavigationControllerDelegate, UITableViewDataSource {
    @IBOutlet weak var intentionsTable: UITableView!
    @IBOutlet weak var intentionField: UITextField!
    public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let intentionInd = intentionsArray[indexPath.row]
        let cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: "cell")
        cell.textLabel?.text = intentionInd.value(forKey: "eIntentionCell") as? String
        return (cell)
    public func tableView(_ intentionsTable: UITableView, numberOfRowsInSection section: Int) -> Int {
        return (intentionsArray.count)
    @IBAction func addIntention(_ sender: AnyObject) {
        self.setValue(intentionField.text, forKey: "eIntentionCell")
        intentionField.text = ""
    @IBAction func refreshTable(_ sender: Any) {


Link to screenshot:


Any help is GREATLY appriciated

Powered by WPeMatico

You may also like...

Comments are closed.