Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

xmax

macrumors member
Original poster
Jul 3, 2008
33
0
I am binding check box value with shared user defaults controller in Interface Builder. I am registering defaults as well.
but user defaults not working. it doesn't saves the status of check box.
There is no plist file created at path /Library/Preferences for my application identifier.


Thanks

xmax
 

Bakerman

macrumors member
Jan 31, 2005
62
7
Sweden
The plist file isn't created at /Library/Preferences, it is created at ~/Library/Preferences.

Make sure that you use the controller key 'values' and then another name like e.g. 'CheckBoxValue' for the model key path.
 

xmax

macrumors member
Original poster
Jul 3, 2008
33
0
Sorry, But i have checked for ~/Library/Preferences.
There is no any plist file created over there.
can you tell me the steps from beginning for saving states of check box.
I have given model key path for check box but i am not getting.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Your bindings might be setup wrong. Can you post a picture of IB with the bindings inspector selected for your checkbox?
 

xmax

macrumors member
Original poster
Jul 3, 2008
33
0
I am sending you my test application in attachment ?

you can find what is the problem ?


Thanks.
 

Attachments

  • UserDefaultTest.zip
    54.8 KB · Views: 98

xmax

macrumors member
Original poster
Jul 3, 2008
33
0
I got what was the problem ?
Actually i was quiting application from debugger. so it was not saving the state of check box. once i quit from Application Menu , it saved the state.
So, I can understand that it will save the states on quiting the application, not on registering defaults.

That concludes , to save the state we have to quit the application. or we can use the method synchronize or setValue:forKey to save the state when application is Running.

am i correct ? what is correct method to save?


Thanks.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Yes, synchronize is what you'd use to save it without waiting until restart. Most of the time you don't need this, just don't kill the app and let it terminate normally.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.