Questions tagged [nsurlrequestcachepolicy]

Specifies the caching behavior of the request

NSURLRequest has a cachePolicy property, which specifies the caching behavior of the request according to these constants:

  • NSURLRequestUseProtocolCachePolicy;
  • NSURLRequestReloadIgnoringLocalCacheData;
  • NSURLRequestReloadIgnoringLocalAndRemoteCacheData;
  • NSURLRequestReturnCacheDataElseLoad
  • NSURLRequestReturnCacheDataDontLoad;
  • NSURLRequestReloadRevalidatingCacheData.

Sources

25 questions
0
votes
0 answers

Is data coming from cache?

Requirement: Get the data from the cache if NSMutableURLRequest can not fetch data from the server.If internet available and i got the data from the server then function will return server data but if request fail to get the data from the server…
0
votes
2 answers

Caching won't work in UIWebView

I have a website which can be used offline too. I have created an app which use UIWebView and I said that my UIWebView should cache this site with the following code [self setRequestObj:[NSURLRequest requestWithURL:loadUrl…
Premox
  • 183
  • 3
  • 23
0
votes
2 answers

NSURLRequestReloadIgnoringLocalCacheData does not work

my code looks like if([[self cache] isEqualToNumber:[[NSNumber alloc] initWithInt:1]]) { [[NSURLCache sharedURLCache] setDiskCapacity:4 * 1024 * 1024]; [[NSURLCache sharedURLCache] setMemoryCapacity:32 * 1024 * 1024]; [self…
Premox
  • 183
  • 3
  • 23
0
votes
0 answers

NSURLSession convert image during uploading

I am uploading an image to my server, and meantime JPG image get converted, and converted image will not anymore readable. Tried to set HTTP "Cache-Control", but no effect it has. Any idea how to prevent conversion? let url: NSURL = NSURL(string:…
János
  • 27,206
  • 24
  • 130
  • 270
0
votes
1 answer

configuration for NSMutableURLRequest, that cachePolicy is always ReloadIgnoringLocalAndRemoteCacheData

In my project I'm working with NSMutableURLRequest. Sometimes there are mistakes because of caching. So I did let mutableURLRequest = makeURLRequestFrom(url: url, httpMethod: "GET", httpHeaders: httpHeaders, parameters: parameters) …
kuzdu
  • 5,943
  • 1
  • 37
  • 56
0
votes
1 answer

AFNetworking: Cache.db created but cache-control → no-cache in server response heder

In my iOS app I'm using AFNetworking library to send POST requests to the server. The server response headers contain cache-control → no-cache. In my custom AFHTTPSessionManager subclass I don't explicitly set the NSURLRequestCachePolicy, so I think…
Giorgio
  • 1,567
  • 4
  • 29
  • 44
0
votes
1 answer

AFHTTPSessionManager with Cache Policy not working

Server sends cache header in response. "Cache-Control": "max-age=120, public" First I used NSURLRequestReturnCacheDataElseLoad with the AFHTTPRequestOperation. By setting shared cache in AppDelegate and setting the…
Julian
  • 29
  • 5
0
votes
1 answer

Stop NSURLRequest writing to cache

I have an iOS app that sends hundreds of HTTP requests per second using NSURLRequest. It's always over WiFi so performance is fine, and the content is different for every response so I've disabled caching via…
Abhi Beckert
  • 30,929
  • 11
  • 77
  • 106
0
votes
1 answer

Which value should I use for NSURLRequestCachePolicy for NSURLRequest?

NSURLRequest +requestWithURL:cachePolicy:timeoutInterval: has a cache policy. The documentation in XCode5 lists an enum with four constants and immediately below lists seven different constants. The documentation is inconsistant. Which options…
Paul Heller
  • 1,161
  • 12
  • 11
0
votes
2 answers

NSMutableURLRequest returns old values even cachePolicy is NSURLCacheStorageNotAllowed

Im using codes posted here: connection release method in connectionDidFinishLoading, causes error now first execute returns didFail log. second execute; returns old response data. albeit my (localhost) server is totally offline. and cachePolicy is…
1
2