Beware of hidden NSTableView columns in Leopard (user defaults name clash)
Beware of hidden NSTableView columns in Leopard (user defaults name clash)
- Subject: Beware of hidden NSTableView columns in Leopard (user defaults name clash)
- From: Peter Maurer <email@hidden>
- Date: Tue, 30 Oct 2007 10:57:36 +0100
Just a little heads-up:
In one of my applications, users are given the possibility to hide
NSTableView columns. To remember those hidden columns, I had put them
in a dictionary (key: column id; value: archived column) and stored
them in my application's user defaults with the following key:
[NSString stringWithFormat: @"NSTableView Hidden Columns %@", [self
autosaveName]]
Back when I implemented this feature, I thought it was nice to name my
settings similar to how I imagined Apple would name them.
Now, after updating to Leopard, my application kept crashing when
retrieving those stored columns. They had somehow automagically turned
into an empty NSArray -- instead of the NSDictionary my application
had stored in the user defaults.
It took me a while to find out why, but it turns out that Leopard's
new isHidden/setHidden NSTableColumn feature uses the exact same
settings key I had chosen. And Apple stores an array for that key.
So before anyone else wastes his time on the same thing, two warnings
are in order, I think:
1. Starting with Leopard, the system uses the "NSTableView Hidden
Columns <AutoSaveName>" user defaults key. If you have been using it,
you'll have to adapt.
2. Generally speaking, don't try to do what you think Apple would do.
If you get it half-right, as I did, you'll be in trouble.
Cheers,
Peter.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden