NSMutableURLRequest setCachePolicy is not used

1.3k Views Asked by At

I have an NSURLMutableURLRequest where I call

[urlRequest setCachePolicy:NSURLRequestReloadRevalidatingCacheData];

When I po [urlRequest cachePolicy] it is always 1.

What is the getter doing that could force it to return 1?

1

There are 1 best solutions below

1
On

I suppose that this policy has not been implemented yet (navigate NSURLMutableURLRequest by means of cmd+click and find NSURLRequestCachePolicy).

enum
{
    NSURLRequestUseProtocolCachePolicy = 0,

    NSURLRequestReloadIgnoringLocalCacheData = 1,
    NSURLRequestReloadIgnoringLocalAndRemoteCacheData = 4, // Unimplemented
    NSURLRequestReloadIgnoringCacheData = NSURLRequestReloadIgnoringLocalCacheData,

    NSURLRequestReturnCacheDataElseLoad = 2,
    NSURLRequestReturnCacheDataDontLoad = 3,

    NSURLRequestReloadRevalidatingCacheData = 5, // Unimplemented
};
typedef NSUInteger NSURLRequestCachePolicy;

This is also well documented in NSURLCache. There is also a radar at http://openradar.appspot.com/radar?id=1755401.