How to delete UIWebView cache only if necessary, e.g. when response status code is 304? I use:
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
from NSURLConnectionDelegate to get status code from the response:
int code = [(NSHTTPURLResponse*)response statusCode];
But the code is always 200 (OK). How to get code 304 (not changed) to know when I need to clear cache?
Thanks in advance.
I don’t understand your question – it is the server that sends http codes, are you asking how to change the server so that it sends 304?
Regardless of that, what is the connection between your UIWebView and the NSURLConnection.
Are you using a NSURLConnection inside of shouldStartLoadWithRequest: for some reason?