title: Caches folder purged (Emptied/Cleared) automatically on iOS
body: <p>I have an app that lets you download "modules" that can expand your app usage.<br>
  When the user downloads a module, I fetch a ZIP file from a server and extract it to his Caches folder. (Each of these zips could be sized anywhere from 60k to 2MB).</p>
  
  <p>Unfortunately, there are over <strong>300</strong> modules available, and many of the users download at least 50-60 of these to their device.</p>
  
  <p>Lately, I got many complaints that modules just <em>disappear</em> off the user device, so I did some investigation and came across the following wording in Apple's documentation.</p>
  
  <blockquote>
    <p>iOS will delete your files from the Caches directory when necessary,
    so your app will need to degrade gracefully if it's data files are
    deleted.</p>
  </blockquote>
  
  <p>And also the following article explaining further about this situation: 
  <a href="http://iphoneincubator.com/blog/data-management/local-file-storage-in-ios-5" rel="noreferrer">http://iphoneincubator.com/blog/data-management/local-file-storage-in-ios-5</a></p>
  
  <p>My problem is, I have no actual way of degrading <strong>gracefully</strong>, since I can't automatically let the user download so many modules. It could take hours depending on the internet connection and size of the modules. </p>
  
  <p>So I have a few questions:</p>
  
  <ol>
  <li>Did any of you ever had to deal with a similar situation, and if yes, how?</li>
  <li>Does anyone know when exactly iOS purges the Cache? What is considered "low space" warning? This way I could at least give the user a warning that he doesnt have enough space to install a new module.</li>
  <li>Is there a way to receive some sort of warning before the Cache folder is cleared? </li>
  </ol>
  
  <p>This is a really frustrating move from Apple and I don't really see a way out. Would really love to hear some ideas from you.</p>