1

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];

1 Answer 1

2

Try this:

// Clear all Cookies and cache
[[NSURLCache sharedURLCache] removeAllCachedResponses];
NSHTTPCookie *cookie;
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (cookie in [storage cookies]) {
    [storage deleteCookie:cookie];
}
Sign up to request clarification or add additional context in comments.

3 Comments

I test but I have the same poblem !
Your only option then is to remove the webview and create a new one. There are no public api's for clearing the history of a webview.
I remove my webview and I create a new one... Adding too a paramater &time=timestamp to have a different url/html code !! It's same ! I don't understand !!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.