2

My image editing app is saving some important data in the documents directory. In a tutorial I was reading this:

iTunes will then display anything you save to the Documents directory in your app to the user, when they go to the “Apps” page in iTunes and scroll to the bottom:

image

I have a subfolder called userImages and it would be clever to restrict file sharing only to that folder and not to everything in documents. Otherwise the user would accidently (or on purpose) mess around with files that the app depends on to work properly. This would be bad.

Is there a way to restrict it to a subdirectory in documents?

Proud Member
  • 40,078
  • 47
  • 146
  • 231

1 Answers1

3

No, what you should do instead is store anything you do not want users seeing in the "Library" directory for the app. Check here for a list of places you can store data:

How can I get a writable path on the iPhone?

Community
  • 1
  • 1
Kendall Helmstetter Gelner
  • 74,769
  • 26
  • 128
  • 150
  • Apparently the Library folder seems to be problematic. See http://stackoverflow.com/questions/6114628/where-to-store-private-important-user-data-when-the-documents-directory-is-not-an – Proud Member May 24 '11 at 18:46
  • To be safe then use the Library/Application Support directory as per the link I gave (there's a constant for that) as very likely that is a directory that is backed up and also restored from backup. However I think anything in /Library except for Caches will be preserved. – Kendall Helmstetter Gelner May 25 '11 at 06:18