title: The connection to service named com.apple.nsurlstorage-cache was invalidated
body: <p>I'm creating a custom keyboard for iOS8, and I'm having a tough time figuring out some issues with NSURLConnection.</p>
  
  <p>I'm using the sendAsynchronousRequest: method like this:</p>
  
  <pre><code>[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
          NSLog(@"recieved asynchronous response");
  
          if (!connectionError) {
              [self connection:nil didReceiveData:data];
              [self connectionDidFinishLoading:nil];
          }
          else{
              NSLog(@"connection failed - %@", connectionError);
          }
      }];
  </code></pre>
  
  <p>This all seems to work correctly for a period of time (1-2 days), and I can correctly receive data. After this time I start seeing the following error message:</p>
  
  <pre><code> ***cachedResponseForRequest:key:handler failed: 
  </code></pre>
  
  <p>Error Domain=NSCocoaErrorDomain Code=4099 "The operation couldn’t be completed. (Cocoa error 4099.)" 
  (The connection to service named com.apple.nsurlstorage-cache was invalidated.) UserInfo=0x17579030 
  {NSDebugDescription=The connection to service named com.apple.nsurlstorage-cache was invalidated.}; {
      NSDebugDescription = "The connection to service named com.apple.nsurlstorage-cache was invalidated.";</p>
  
  <p>The only way I then seem to be able to make things work correctly again is to reset the content and setting on the phone. If anyone could point me in the correct direction as to why this is happening I would be very grateful. Thanks in advance.</p>