Reputation: 75
I have an application IOS who load the same url but with different content every 5/10 seconds. On my website I count how often my url websie is call by my application. When I call my website in a browser (safari/chrome/fiefox...) My website count the good number of times. When I call my website with my Application. my website don't count the good number of times. it's lower.
I think that is on account of the cache.
How to desable cache on a Uiwebview IOS application ?
I have already in my code [[NSURLCache sharedURLCache] removeAllCachedResponses];
with my request but I think this is when I load in my UIwebview.
NSString *html = @"<head></head><body style='padding:0;margin:0;'><script src='http://url_with_content.com'></SCRIPT></body>";
NSString *script = [[NSString alloc] initWithFormat:@"%@", html];
[adView loadHTMLString:script baseURL:nil];
Upvotes: 1
Views: 1603
Reputation: 91
Try this:
// Clear all Cookies and cache
[[NSURLCache sharedURLCache] removeAllCachedResponses];
NSHTTPCookie *cookie;
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (cookie in [storage cookies]) {
[storage deleteCookie:cookie];
}
Upvotes: 2