title: iphone: NSURLCache on disk
body: <p>I'm having trouble with caching URLResponses to disk. I want that because the data i'm downloading needs reloading when the expires-tag in it's http-header is met, not earlier. Also, I want iPod touch-Users to be able to download the data once while online and then use it offline.</p>
  
  <p>i'm doing this which works fine for caching things in memory but fails when relaunching the app:</p>
  
  <pre><code>NSURLRequest* menuRequest = [NSURLRequest requestWithURL:mensaURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval: 10];
  NSCachedURLResponse* cachedMenuResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:menuRequest];
  if (cachedMenuResponse) {
      // received data is a member of that class to which the asynchronous 
      // download writes and which is then being used in updateDataFromDownload
      // to retrieve my data structure from the download.
      self.receivedData = [NSMutableData dataWithData:[cachedMenuResponse data]];
      [self updateDataFromDownload];
      NSLog(@"using data from cache");
  } else {
      NSLog(@"opening connection");
      [NSURLConnection connectionWithRequest:menuRequest delegate:self];
  }
  </code></pre>