Questions about NSUserDefaults

2019-06-12 15:34发布

I have a couple of questions about NSUserDefaults in Mac OS X:

  1. When does the NSUserDefaults use the dictionary provided by registerDefaults? Only the first time the application is opened or every time the application is opened?
  2. Where is the information from NSUserDefaults stored?
  3. How can I reset NSUSerDefaults?

Thanks!

2条回答
Animai°情兽
2楼-- · 2019-06-12 16:11
  1. Only the first time. But you can force an application to reuse the defaults with the terminal.
  2. ~/Library/Preferences/YourIdentifier.plist (e.g. com.apple.finder.plist)
  3. Terminal: defaults delete YourIdentifier (e.g. com.apple.finder)
    Code: [NSUserDefaults resetStandardUserDefaults];
查看更多
Rolldiameter
3楼-- · 2019-06-12 16:31

Actually it should change. I would try it with other controls like NSTextField. When it doesn't work you're doing it wrong

The idea of binding is exactly what you thought it is.

查看更多
登录 后发表回答