title: Offline mode using NSURLCache
body: <p>I am using AFNetworking with NSURLCache. Requests are created with <code>NSURLRequestUseProtocolCachePolicy</code>. App receives responses with headers:</p>
  
  <pre><code>Etag = "1398684731";
  Cache-Control = "public";
  </code></pre>
  
  <p>and everything works perfect. But now I need to add an offline mode. </p>
  
  <p>How it should work:</p>
  
  <ul>
  <li>If internet connection is available everything should work as usual
  (application asks back-end for new data and if it has different
  <code>Etag</code> new data is downloaded if <code>Etag</code> is the same - cached response
  is used). </li>
  <li>If there is no internet connection - cached response is
  used.</li>
  </ul>
  
  <p>The problem is that in offline mode requests fail.</p>
  
  <p>I have tried to solve this using various <code>Cache-Control</code> options but it seems that it does not work this way.</p>
  
  <p>I have found possible solution here <a href="https://stackoverflow.com/a/15885318/3140927">https://stackoverflow.com/a/15885318/3140927</a> . It should work but it is not very elegant and I think something might have changed in the last year.</p>
  
  <p>Also I have found that "NSURLCache was not made for explicit offline scenarios and that it was designed to speed up Safari and should not be used for manual downloads". Will SDURLCache be better for my purposes?</p>
  
  <p>So what could be the best way to implement offline mode?</p>