tableView error - not allowed?


I get an error come up ref to page 168 when editing the dataOfType: method:

When I type :

[[tableView window] endEditingFor:nil]

I get 2 red errors :
"Unknown receiver ‘tableView’;did you mean NSTableView?“
"No known class method for selector ‘window’”

any idea where I’ve gone wrong. It all worked ok up to this point.


Maybe you forget to add the outlet tableView in your RMDocument.h:

@property (weak) IBOutlet NSTableView *tableView; and/or @synthesize tableView; in RMDocument.m

Or you misspelled the name e.g. tabeview



You shouldn’t need a property for tableView*. It should have been created as an instance variable in Chapter 9 (p.156). Check the spelling and that it was added in RMDocument.h.

  • And furthermore, to use a property you need to be sending a message to self, such as [self tableView], which we’re not here… just accessing the variable directly.


Thanks guys - I thought the’ begin edit on insert 'part on p156 was a ‘nice to do’ so I skipped it and went to archiving little realising what was missed out. Should have seen it!



I also had a problem with this technique, but not because of any errors in Xcode.

In dataOfType:error: on my Document subclass, I implemented the following line:

[[[self tableView] window] endEditingFor:nil];

The problem that this creates is that if I launch my application with an existing document and begin editing one of the records in in my document, the autosave system kicks in after I’ve made one or two character changes. Autosave then apparently calls dataOfType in order to save the document, and -endEditingFor promptly locks the document for further editing. The result is that instead of being able to change, say, a person’s name from “John Doe” to “Jane Doe”, I get two characters typed in and then the field is locked, resulting in a new name of “Ja”.