I've got a NSTableView, with 1 column, whos "Content" is binded to user defaults and the column "Value" is also binded.
My code is here - https://gist.github.com/6df8d2e338c0595c1ef9
For some reason, if I run my application, add/remove items, then quit and re-launch, nothing's been saved and the table is as开发者_StackOverflow it was when I first originally started it. Why isn't it saving?
If you take a look at the link above (my code), I am calling [[NSUserDefaults standardUserDefaults] synchronize]; etc.
Your array in NSUserDefaults is immutable. This is why it won't work.
Use a NSArrayController and bind your column to it's arrangedObjects. Then bind the content of the NSArrayController to your user defaults.
精彩评论