iOS 5 does not allow to store downloaded data in Documents directory? iOS 5 does not allow to store downloaded data in Documents directory? objective-c objective-c

iOS 5 does not allow to store downloaded data in Documents directory?


Here are the trade-offs:

  • If you put your files in the Documents directory then they are backed up to iTunes or iCloud but if they are too big and it's possible to download the files again then Apple may reject your app
  • If you put your files in the Cache directory then they won't be backed up and Apple won't reject your app. However, when iOS 5 gets low on space it may delete all the files in there.

However, with iOS 5.0.1 there is a third option:

  • Put files in Documents but flag them so that they are not backed up. There's a technote (QA1719) on how to do this.

I think this is probably the best answer for you.


1. Should I have to change my code to store the downloaded data to Library/Caches directory instead of to the Documents directory? = Yes, you need to store the downloaded data to Library/Caches directory.

2. Where should my database file be placed (to Documents or Caches)? = You can keep the database in Documents directory.


One app I know was once rejected because of this. Storing downloadable data in Documents dir is not recommended. The logic behind it is that your data should not unnecessarily inflate the app directory. This app directory is backed up in iCloud, so inflated app directory will cause more data to be saved in iCloud.

If data can be downloaded again, like magazines, books pdf etc. Then keep it in Caches directory. Of course you can store pointers to data (like URLs etc) in the Documents directory so that the user can retrieve them later.

To answer your questions:

  1. Yes, change your code to load DB from Documents and Data from Caches.
  2. Keep database in Documents

You'll have to add code to check if a document in DB exists in Caches, if it doesn't your app should download it again.