when the user launches my application for the first time, I downloaded all the images and saved them in my cache folder, which is located in the library directory: Library / Cache / imgcache / myApp / ready /
Let’s say a file with the name:
HTTP / __ wscdn.bbc.co.uk_worldservice_assets_images_2012_01_13_120113094952_international_space_station_304x171_reuters_nocredit.jpg
Now, when the user logs off the network, I process html with loadHTMLString, if html contains any img src of the previous saved file, it is downloaded from the cache not from the Internet, since the user does not have access to the Internet.
Now my question is: how can I deal with this problem? How can i do this? Please help me.
Example:
I have a line with html in it,
>"<div class="g-container story-body"> <div class="bodytext"> <div class="module "> <div >class="image img-w304"><img width="304" height="171" >src="http://wscdn.bbc.co.uk/worldservice/assets/images/2012/05/18/120518135959_facebook_304>x171_bbc_nocredit.jpg" alt=""/> <div class="module "> <div class="image img-w304"><img >width="304" height="171" >src="http://wscdn.bbc.co.uk/worldservice/assets/images/2012/05/18/120518145635_facebook_304>x171_bbc_nocredit.jpg" alt=""/><p class="caption"></p> </div> </div> <p></p> </div> </div> ><div class="g-container story-body"></div>"
I cached these two images in the user documents folder, now that the user does not have access to the network, I want to do something like this:
><div class="g-container story-body"> <div class="bodytext"> <div class="module "> <div >class="image img-w304"><img width="304" height="171" >src="**Library/Caches/imgcache/myApp/ready/**http://wscdn.bbc.co.uk/worldservice/assets/ima>ges/2012/05/18/120518135959_facebook_304x171_bbc_nocredit.jpg" alt=""/> <div class="module >"> <div class="image img-w304"><img width="304" height="171" >src="**Library/Caches/imgcache/myApp/ready/**http://wscdn.bbc.co.uk/worldservice/assets/ima>ges/2012/05/18/120518145635_facebook_304x171_bbc_nocredit.jpg" alt=""/><p class="caption">>>``</p> </div> </div> <p></p> </div> </div> <div class="g-container story-body"></div>
source
share