title: Having separate cookie storage for two UIWebView?
body: <p><strong>Background</strong><br>
  I am developing a simple iPad application that allow the user to browse the same website with different logins at the same time. Therefore I have two <code>UIWebView</code> and they should have different cookie storage so the user can login one account on the first <code>UIWebView</code> and another account on the second <code>UIWebView</code>.</p>
  
  <p><strong>What have I tried?</strong><br>
  I think the solution is to implement different cookie storages in the two <code>UIWebView</code> I have.</p>
  
  <p>Sasmito Adibowo wrote an article <a href="http://cutecoder.org/programming/implementing-cookie-storage/" rel="noreferrer">Implementing Your Own Cookie Storage</a> which provide details on how to use a custom cookie storage for <code>WebView</code> on Mac.<br>
  It is done by modify the NSURLRequest that <code>WebView</code> is going to send, adding cookie headers to it, and also intercept the response from <code>WebView</code> and extract the cookies from the response header and save it to our own cookie storage.<br>
  Technically, it is done by implementing these two delegate methods:</p>
  
  <pre><code>- (void)webView:(WebView *)sender resource:(id)identifier didReceiveResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)dataSource
  - (NSURLRequest *)webView:(WebView *)sender resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)dataSource
  </code></pre>
  
  <p>Although it is undocumented, <code>UIWebView</code> did support one of the method above with a slightly different method name:  </p>
  
  <pre><code>- (NSURLRequest *)uiWebView:(UIWebView *)sender resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(id)dataSource
  </code></pre>
  
  <p>However, <code>UIWebView</code> don't have a equivalent delegate method for <code>webView:resource:didReceiveResponse:fromDataSource:</code> and hence I cannot extract the cookies from the response headers.</p>
  
  <p><strong>The Question</strong><br>
  Is there a way to have <code>UIWebView</code> to use a custom cookie storage, so the two <code>UIWebView</code> can have their own cookie storage?</p>
  
  <p>Thanks!</p>