1

I have a big problem with NSUserDefaults : I receive a feedback from an user who just updated the application from AppStore and he complained that some of the values from NSUserDefaults are gone.

There is a little possibility that the NSUserDefaults lose some data after application update? I read about this problem and some guys have this problem too, but I don't receive a clear answer.

Thanks

Chirila Vasile
  • 359
  • 1
  • 2
  • 11

1 Answers1

1

NSUserDefaults are not usually reset unless the user deletes the app.

For basic data, NSUserDefaults is the best way to save data such as preferences, dates, strings etc. If you need to save images and files, the file system is better. (NSCoding)

If you have large datasets you should use CoreData or SQL on an separate server.

Woodstock
  • 22,184
  • 15
  • 80
  • 118
  • Same answer everywhere. And when I mean same answer, it's exactly same.I understand for what is NSUserDefaults used for, but I need an answer because it's very annoying my situation. – Chirila Vasile Sep 04 '14 at 12:00
  • @ChirilaVasile - It's not exactly the same - I provided a little more information. But you are right, maybe you shouldn't have asked a question that was already answered? – Woodstock Sep 04 '14 at 12:01
  • Nobody had a clear answer : I know that we can't know what is really happening but I am very curious if large data in NSUserDefaults can really affects it's persistence. If does, I'm gonna be mad :) – Chirila Vasile Sep 04 '14 at 12:02
  • What kind of data are you trying to store? how large? – Woodstock Sep 04 '14 at 12:06
  • I am just saving some dictionaries, not NSData or something like this. Just some dictionaries (from my point of view, I cannot consider these large data, but for NSUserDefaults probably is?) – Chirila Vasile Sep 04 '14 at 12:07
  • You should use NSKeyedArchiver and NSCoding - it's pretty easy to implement! – Woodstock Sep 04 '14 at 12:26
  • It's not about implementing because I can do Core Data or a .plist file. – Chirila Vasile Sep 04 '14 at 12:34
  • Do you think that using NSKeyedArchiver to encrypt data for writing into file is a safer mode? Are you sure I won't lose data? – Chirila Vasile Sep 05 '14 at 14:33