NSMutableRequest cache policy seems overly restrictive.
normanhh3 opened this issue · 2 comments
I've got an application where I'd like to have the ability to view the RSS feed content offline but as I look into how the feed URL is pulled in, basically all caching capabilities specified by the client are wiped out.
The following definition ought not to be the default, in my opinion but should be left at the default cache policy NSURLRequestUseProtocolCachePolicy
from here.
Option 1
Utilize an additional init parameter to send in the NSURLRequestCachePolicy
value.
Option 2
Or possibly the NSURLRequest ought to just come in on the init method so that more of the request can be modified and the init would accept an NSMutableRequest
instead of just an NSRequest
.
Current Code in MWFeedParser.m
// Request
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url
cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData
timeoutInterval:60];
For some background on the iOS caching dilemma you might check out this article - http://blackpixel.com/blog/2012/05/caching-and-nsurlconnection.html
If either of these options sounds good, I'll go ahead and implement either one, probably Option 2 ultimately for ongoing flexibility.
I ended up removing that commit due to some issues I missed in my first pass. :-( Next commit is a clean compiling and working version.
Yep, I'm happy with all of this and it should be included in the main branch shortly. Thanks for the suggestion!