Wednesday, May 1, 2013

NSURLRequest NSURLRequestReloadIgnoringLocalCacheData example ios


enum
{
   NSURLRequestUseProtocolCachePolicy = 0,
   NSURLRequestReloadIgnoringLocalCacheData = 1,
   NSURLRequestReloadIgnoringLocalAndRemoteCacheData =4,
   NSURLRequestReloadIgnoringCacheData = NSURLRequestReloadIgnoringLocalCacheData,
   NSURLRequestReturnCacheDataElseLoad = 2,
   NSURLRequestReturnCacheDataDontLoad = 3,
   NSURLRequestReloadRevalidatingCacheData = 5
};

typedef NSUInteger NSURLRequestCachePolicy;



NSURLRequestReloadIgnoringLocalCacheData
Specifies that the data for the URL load should be loaded from the originating source. No existing cache data should be used to satisfy a URL load request.


Example of [NSURLRequest NSURLRequestReloadIgnoringLocalCacheData]

NSString *urlString = [NSString stringWithFormat:@"http://test.localhost/api/request.php?url=%@", passedValue];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString] cachePolicy: NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:15.0];

Example of [NSURLRequest NSURLRequestReloadIgnoringLocalCacheData]

NSURLRequest *lRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:link] cachePolicy: NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:20.0];