Questions about NSUserDefaults

此生再无相见时 提交于 2019-12-08 10:42:33

问题


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!


回答1:


  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];



回答2:


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.



来源:https://stackoverflow.com/questions/5264727/questions-about-nsuserdefaults

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!