Newbie: NSTable Autosave name not conforming to NSCoding
Newbie: NSTable Autosave name not conforming to NSCoding
- Subject: Newbie: NSTable Autosave name not conforming to NSCoding
- From: Jay Prince <email@hidden>
- Date: Tue, 1 Oct 2002 00:34:18 -0700
This doesn't seem to be in the archives. I have an application with a
couple NSTables, and I'm using a single controller.
So, thinking I was clever, I decided to create an NSDictionary that had
the datasources (each being an NSArray) in it with the keys being the
autosave names for the NSTableViews. So, I just took the table, get
its autosave name, and use that to get the NSArray that is the source,
then get the row num, and then use the column identifier to get the
correct data out of the NSDictionary. Lets review: NSDictionary (of
TableView sources identified by autosavename) --> NSArray (of table
rows, rownum) --> NSDictionary (of a given rows data, column identifier)
Doing so, causes this to happen (before awakeFromNib gets called, and
also later):
Exception raised during posting of notification. Ignored. exception:
Column identifiers used with NSTableView autosave feature must conform
to NSCoding protocol.
I found a long ago release note that talks about how you need to make
the tablecolumn identifier a string or a number, which I'm doing.
(Setting strings in Interface Builder, which are the keys to look up
the correct NSArray). The Column identifiers are text set in IB, the
autosave names are text set in IB. I don't see what can be done to
make them more conform to NSCoding.
To test this, I took away the autosave names, and the exceptiom goes
away (but my tables are empty because I don't know which table is
asking for the data.) The sample code out there I've seen doesn't have
this problem, but also doesn't set autosave names in IB.
IF there's something fundamentally wrong with this strategy-- what is
the correct way to tell which NSTableView is asking for data when
multiple tables share a delegate? Comparing the NSTableView passed in
to the ones connected up to outlets in IB doesn't work, apparently they
are different objects. I could set a tag for them... but I did want
to make use of the autosaving feature, actually.
I can use the tag if that's the officially sanctioned way-- I just tend
to be more likely to put the wrong tag value in, and rarely put the
wrong name in for an autosave name.
Jay
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.