views:

30

answers:

2

I'm looking to archive some nested NSDictionary objects to be able to use the data in them at next start. To do so I was going to use [NSKeyedArchiver archiveRootObject: toFile: ] but was not sure where to put the file. In the archiving docs, the examples put the file in NSTemporaryDirectory() but for persistent data, a temporary directory does not seem to make much sense. I've had a look around but can't find where would be the best place to put it unless NSDocumentDirectory is for use by apps for this kind of thing?

+1  A: 

You have two options for persistent file storage:

  • NSDocumentDirectory if you want files to be backed up by iTunes
  • NSCachesDirectory if you don't want to backup those files to improve device synchronizing time or for some other reasons - e.g. some files that can be easily recreated when needed
Vladimir
A: 

hi,

what i know is that preferences you save in the "Library/Preferences" directory. Other data which should persist should be saved in the "Documents" directory. (if you have the book "iphone programming" from the big nerd ranch you will find a good description in chapter 14)

bye

Micko
oh, Vladimir was faster ;). and right, there is also the "Library/Caches" directory, which for me doesn't make so much sense because it's not backup as Vladimir described it.
Micko
Thanks. I don't have that book but maybe I should get a copy...
mmdeas