Good evening! I'm hoping someone out there can help me out with a problem I'm seeing.
Ever since iOS 7 was rolled out the following call does NOT work:
NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:60];
Whenever I update the page pointed to by url
above it pulls old content - even if I reboot the device. This problem is seen by multiple (all maybe) users of my app.
Something changed between iOS 6 and iOS 7. Does anyone have any pointers on how to reliably pull a remote file (HTML in this cases) while ignoring any and all caches? Seems like the way I WAS using is not longer working/supported.
Thank you!
According to the NSURLRequest
headers, NSURLRequestReloadIgnoringLocalAndRemoteCacheData
is unimplemented, so I wouldn't rely on it. You may want to use NSURLRequestReloadIgnoringLocalCacheData
and try to avoid the server cache on your server side.
enum
{
NSURLRequestUseProtocolCachePolicy = 0,
NSURLRequestReloadIgnoringLocalCacheData = 1,
NSURLRequestReloadIgnoringLocalAndRemoteCacheData = 4, // Unimplemented
NSURLRequestReloadIgnoringCacheData = NSURLRequestReloadIgnoringLocalCacheData,
NSURLRequestReturnCacheDataElseLoad = 2,
NSURLRequestReturnCacheDataDontLoad = 3,
NSURLRequestReloadRevalidatingCacheData = 5, // Unimplemented
};
typedef NSUInteger NSURLRequestCachePolicy;
I ended up having to use the "timestamp" solution found in this post:
NSURLConnection is returning old data
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With