0

I am programming an assignment planner for iPhone and have run across an error in my code upon attempting to view my 2nd view. At this point I only have two views, and the first view(main) loads fine upon app launch. The first view is a tableview and the second view has one text field that saves the Assignment title, the second field is a date picker that saves to core data as type String. When I run the code, it gives me no error in the debugger, and just in Thread 1 it throws a SIGABRT error in the AppDelegate.swift file.Here is a screen cap of the error that comes up when I try and run the application. on the iPhone 5s.

This is my action for the second view that should add the assignment

    @IBAction func btnAddAssignment(sender: UIButton) {
    if (txtAssignment.text == ""){
        error.text = "Please try again, you must add a name."
        //Task Title is blank, do not add a record
    } else {
        //add record
        //handles date formatting to string
        // TODO, Wrap in a method for later use
        let dateFormatter = NSDateFormatter()
        dateFormatter.dateFormat = "dd-MM-yyyy HH:mm"
        let strDate = dateFormatter.stringFromDate(due_date.date)
        let stringDueDate = strDate

        let name: String! = txtAssignment.text!
        let final_due_date: String! = stringDueDate

        taskMgr.addAssignment(name, due_date: final_due_date)
    }
}

"2016-07-26 15:02:28.957 TaskMate[2410:200555] *** Terminating app     due to uncaught exception 'NSUnknownKeyException', reason: '[<TaskMate.FirstViewController 0x7fe9ba520ce0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key tblTasks.'

Any other files that you need please ask for! Thanks!

  • 1
    Click the button in the bottom-right to show the console and add the exception message + stack trace that is in it to your question. – dan Jul 26 '16 at 21:58
  • "2016-07-26 15:02:28.957 TaskMate[2410:200555] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key tblTasks.' – chrishorton Jul 26 '16 at 22:05
  • @dan looks like it's a key value problem but I don't see where that's coming from – chrishorton Jul 26 '16 at 22:05
  • Possible duplicate of [What does this mean? "'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X"](http://stackoverflow.com/questions/3088059/what-does-this-mean-nsunknownkeyexception-reason-this-class-is-not-key-v) – dan Jul 26 '16 at 22:06
  • Will try it out and see if it works @dan – chrishorton Jul 26 '16 at 22:09

0 Answers0