nsurlcache

UIWebView and NSURLCache have a troubled relationship

I am trying to solve 2 things in my UIWebView: Load local assets in place of remote ones, under the right conditions Load remote assets as normal if there are no local ones or they are outdated Allow the webview to go "back" without needing to reload it's html form the server So to handle #1 and #2, I implemented a custom subclass NS...

Mutable NSHTTPURLResponse or NSURLResponse

I need to modify response headers in an NSURLResponse. Is this possible? ...

NSURLCache Memory Size is zero

I am having trouble caching NSURLConnection responses using a synchronous call. I initialize the cache in one class and then use it in another. Notice how the cache memory capacity gets initialized to 100KB but then is magically reset to zero later. - (id)init { if (self = [super init]) { // Creates a custom URL cache that...

NSURLCache crashes with autoreleased objects, but leaks otherwise...

UPDATE: After submitting a radar to Apple it appears that this is a known issue (Radar #7640470). CSURLCache is designed to cache resources for offline browsing, as NSURLCache only stores data in-memory. If cachedResponse is autoreleased before returning the application crashes, if not, the objects are simply leaked. Any light that co...

iPhone: Performances Differences Between NSURLRequestCachePolicy Settings

When using NSURLRequest on the iPhone, what are the real world performance differences between the various NSURLRequestCachePolicy settings? I am specifically interested in the cache policy's effect on the the user's perception of the speed at which UIWebView pages display. I have been using the default NSURLRequestCachePolicy but I th...

NSURLCache Problem with cache response

Hello, I'm writing an iPhone application, one of it's tabs is a twitter feed, i'm parsing twitter xml and putting it nicely inside a table view. In case there is no internet connection I would like to show cache results of the last time we had internet connection and the tables were updated. I'm using NSURLCache for that like so: NSURLR...

How do I share Safari's NSURLCache store?

Background I'm building an app that links recent web pages you've visited together. To do this, I need to get the HTML for recent URLs using Cocoa. Right now, I'm using an invisible WebView to do this. As I understand it, if the URL isn't in the cache for my app, this is hitting web servers. What I want The chances are high that t...

problem with custom NSProtocol and caching on iPhone

My iPhone app embeds a UIWebView which loads html via a custom NSProtocol handler I have registered. My problem is that resources referenced in the returned html, which are also loaded via my custom protocol handler, are cached and never reloaded. In particular, my stylesheet is cached: <link rel="stylesheet" type="text/css" hre...

UIWebView NSURLRequestReloadIgnoringLocalCacheData doesn't actually ignore the cache

I have a UIWebView object, with the caching-policy specified as: NSURLRequestReloadIgnoringLocalCacheData This should ignore whatever objects are in the local cache and retrieve the latest version of a site from the web. However, after the first load of the site (ten resources in trace, HTTP GET), all subsequent loads of the site only ...

URL filtering for UIWebView on the iPhone

Can someone please shed some light on how I would get this to work: http://www.icab.de/blog/2009/08/18/url-filtering-with-uiwebview-on-the-iphone/ I tried making the "FilteredWebCache.h" and "FilteredWebCache.m" files in my project, but it said that "FilterManager.h" did not exist. What am I meant to do with those files? This I put in ...

URLCache - iPhone SDK

Hello everyone.. I need some help in using the NSURLCache to download a simple file. It would need to be saved in the Documents folder of the app. I have seen the URLCache example that apple presented, but I didn't find it useful since it was an image that was being shown. In addition there was some complex code on the modification date...

Memory Leak when using SDURLCache (subclass of NSURLCache)

I am using Olivier Poitrey's SDURLCache (github link) as an alternative to NSURLCache to enable disk-caching in an iPhone app. It works very well but is curiously leaking a NSHTTPURLResponseInternal when a disk cached object is returned (no leak when object is returned from memory or no object found). The following code snippet shows ho...

UIWebView and NSUrlCache

I have a NSURLCache that simply logs cachedResponseForRequest and storeCachedResponse calls. It seems that UIWebView will call cachedResponseForRequest for every request, but storeCachedResponse will only be called for the top-level page, i.e. not for any css/js/etc. specified in the html. Is there any reason why this might be (not) h...

Overriding NSURLCache's cachedResponseForRequest to cache UIWebView assets with Three20

Hi all, I need to cache a web-sourced image (i.e. not bundle sourced) that is going into a webview. Normally I'd just request the image and convert it into base-64 and stick it in the HTML, but if I have 100 images in line I can't quite do that. So I searched around a bit and found a way to grab the image request by subclassing NSURLCa...