2

I have an app which has in bundle a css file and more html files. When the user taps a button I change the css file and call [webView reload] but nothing happens. I think this is because the webview caches the old css file and reloads the page using that one.

How can I prevent this?

I tried using the info found here but I don't really understand what the technique is about.

Do I have to change the style.css somehow? Do I have to add the version variable to it?

because If I only use this line of code:

[htmlString stringByReplacingOccurrencesOfString:@"style.css" withString:[NSString stringWithFormat:@"style.css?time=%@", [[NSDate date] description]]

my app crashes.

Any pointers of how to solve this problem would be great. Thank you!

Community
  • 1
  • 1
Horatiu Paraschiv
  • 1,750
  • 2
  • 15
  • 37

1 Answers1

0

Are you using the same filename for both CSS files? If you think that the UIWebView is caching one of them, then just name the other something different.

Neal L
  • 4,329
  • 8
  • 34
  • 39