• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Beware of hidden NSTableView columns in Leopard (user defaults name clash)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Beware of hidden NSTableView columns in Leopard (user defaults name clash)


  • Subject: Re: Beware of hidden NSTableView columns in Leopard (user defaults name clash)
  • From: Corbin Dunn <email@hidden>
  • Date: Tue, 30 Oct 2007 06:29:44 -0700


[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.

Yeah, sorry about that! Generally, things stored in the user defaults that begin with "NS" are reserved for Apple use (as you discovered). It is also good to avoid method names that we "might" use, like "isHidden/setHidden" on NSTableColumn. The easiest way to avoid these type of conflicts is to use some unique prefix of your own. If you are targeting your app on Tiger and Leopard, you can do some "respondsToSelector:@selector(isHidden)" checks, and use the built in logic if available, or your own logic (or, opt to always use your own no matter what).


--corbin
_______________________________________________

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


References: 
 >Beware of hidden NSTableView columns in Leopard (user defaults name clash) (From: Peter Maurer <email@hidden>)

  • Prev by Date: Re: Toolbars, TableViews and Animation
  • Next by Date: [ANN] MBThreadingProxies and MBFileEvents
  • Previous by thread: Beware of hidden NSTableView columns in Leopard (user defaults name clash)
  • Next by thread: Re: Beware of hidden NSTableView columns in Leopard (user defaults name clash)
  • Index(es):
    • Date
    • Thread