开发者

User Defaults not saved

开发者 https://www.devze.com 2023-03-01 16:39 出处:网络
I\'ve got a NSTableView, with 1 column, whos \"Content\" is binded to user defaults and the column \"Value\" is also binded.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消