0

Situation: Mac OS X 10.6 Swift 4.2 Xcode 10.0 application. Data stored in Sqlite db which is then placed into an array for an array controller and tableview. The Object Controller for the ArrayController has the Mode set to Class and the Class Name is "Recording" (no quotes) with the following structure (in a swift file titled Recording):

@objc(Recording)
class Recording: NSObject {
    @objc dynamic var user: UUID
    @objc dynamic var recordingdate: Date
    @objc dynamic var recordingtime: String
    @objc dynamic var occurrence: String
    @objc dynamic var reading: Int32
    @objc dynamic var note: String

    init(user: UUID, recordingdate: Date, recordingtime: String, occurrance: String, reading: Int32, note: String) {
        self.user = user
        self.recordingdate = recordingdate
        self.recordingtime = recordingtime
        self.occurrence = occurrance
        self.reading = reading
        self.note = note
    }
}

The ArrayController is bound to the ViewController with the Model Key Path set to RecordingsArray which is an array of Recording objects.

The TableView Table Content is bound to the ArrayController with the Controller Key being set to arrangedObjects. There are 3 columns with each Table View Cell bound to their Table Cell View with the ModelKey Paths set to objectValue.aRecordingVar.

The issue is I keep getting the following error:

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

The Sqlite db has an entity called Recordings with the following attributes:

note: String
occurrence: String
recnum: Int32
recording: Int32
recordingdate: Date
recordingtime: String
user: UUID

I have cleaned and rebuilt the project with no affect and watched numerous youtube videos and google searches about this subject with no deviation from the process. Does anyone have any ideas on what's wrong?

chasahodge
  • 373
  • 1
  • 4
  • 11
  • 1
    "this class is not key value coding-compliant for the key Recordings.": What class? Could you show the full error message? – Larme Oct 24 '18 at 14:49
  • The class is the Recording class shown in the listing above. The complete error message is quite long but the statement given is the gist of the error listing. – chasahodge Oct 24 '18 at 14:55
  • Please, show the full error message at least the `this class is not key value coding-compliant for the key RecordingsArray.` part. Could it be an issue of wrong class set in InterfaceBuilder? A renaming? Etc. – Larme Oct 24 '18 at 14:56
  • Also show the declaration of `RecordingsArray`. – Joakim Danielson Oct 24 '18 at 14:59
  • 2018-10-24 10:49:54.524851-0400 Unknown class in Interface Builder file at path ~/Contents/Resources/Base.lproj/Main.storyboardc/RecordingsVC.nib. [General] [ valueForUndefinedKey:]: this class is not key value coding-compliant for the key RecordingsArray. – chasahodge Oct 24 '18 at 15:02
  • `NSViewController ` doesn't seem to be a custom class... That's why I ask for the whole error message, especially the class since this kind of error "this class is not key value coding-compliant for the key " is well known on SO. – Larme Oct 24 '18 at 15:15
  • Possible duplicate of [What does this mean? "'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X"](https://stackoverflow.com/questions/3088059/what-does-this-mean-nsunknownkeyexception-reason-this-class-is-not-key-v) – Larme Oct 24 '18 at 15:15

1 Answers1

0

Larme, thanks for the replies, it made me take a closer look at my assignments and I found that I had the wrong ViewController swift file assinged the nib file in the Storyboard. Everything works now.

chasahodge
  • 373
  • 1
  • 4
  • 11