I’m storing certain values in NSUserDefaults, but after several sessions, I find nil values for those variables whenever I’m retrieving them. It’s nowhere that I’m resetting them in my whole program. How can this happen?
Thanx in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you register default defaults and set them to nil, in principle an interrupted or mismanaged write to defaults will cause a reversion to the nil default default the next time the app loads. I have never seen that happen, however. Crashes can also corrupt the defaults.
It is more likely that you are simply accidentally setting them to nil somewhere.