I have an application with a UIWebView where I display some html content.
The content is first downloaded from the web, and then saved to the cache in /library/cache for reuse.
The images are also saved to the cache.
The html code that is saved to the cache is changed so that the ‘src’ code for the image point to the exact folder – where the images have been saved on cache.
When I load the page from the cache, the images doesn’t display with iOS 5. I even don’t have the “?” icon for missing files. No errors. And it is working perfectly on all other iOS except with the actual iOS 5.
Anyone got an idea or experiencing the same problem ?
Yes im using the loadHTMLString method
I found this in the docs and other topics:
Issue: UIWebView can’t load local resources in apps built against 3.0.
When using [UIWebView loadHTMLString:baseURL:], the HTML string should not refer to local resources with the file:// scheme. Instead, pass in NULL or a file:// URL for baseURL:, or include the resources directly in the HTML with <style> and <script> tags.
And Im using [UIWebView loadHTMLString:baseURL:] to load the html from the cache, and my app was build against 3.0
My baseURL was fixed to the url of my server. If now I put ‘NULL’ in the baseURL, the images are displayed correctly with iOS 5.
What I just don’t get is why the images don’t get displayed if I put an url for the baseURL, and thus just with iOS 5 – while with the other iOS the image are displayed.
The project has been build and deployed with XCode 4.2 a few month ago – I don’t know if this is usefull. It has ever worked ! But the issue with loadHTMLString make me think it was not supposed to work with the other iOS ?!?
Are you loading the Data in the WebView with the loadHTMLString method?
If yes, then you should pass in he baseUrl the NSCachesDirectory