IPhone : Disable/clear automatically cache in webview…

on Saturday, February 21, 2015

I created an app for iOS. In this app I have a webview linked with my homepage. But: there is always the same content like at the first start of the app. When I change something at my homepage or any link in it it doesn't change on my iOS device. Perhaps it is saved in cache? Notice: There is always the same content in the webview although I changed something at my homepage. I think it is the cache?!


How can I disable the cache? Or better, the cache should clear automatically, per example at start of the app.


Can anybody help me please?


Here is my code in ViewContoller.m



#import "ViewController.h"
@implementation ViewController
-(IBAction)refresh:(id)sender; {

NSURL *url=[NSURL URLWithString: @"http://examle.com"]; NSURLRequest * requestURL=[NSURLRequest requestWithURL:url]; [_site loadRequest:requestURL];

}
- (void)viewDidLoad {

[self refresh:self];

NSString *path = [[NSBundle mainBundle] pathForResource:@"Plan" ofType:@"pdf"];
NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[_ImageInWebView loadRequest:request];
[_ImageInWebView setScalesPageToFit:YES];

path = [[NSBundle mainBundle] pathForResource:@"Book" ofType:@"pdf"];
url = [NSURL fileURLWithPath:path];
request = [NSURLRequest requestWithURL:url];
[_PDFInWebView loadRequest:request];
[_PDFInWebView setScalesPageToFit:YES];

[super viewDidLoad];

_myBotton.layer.borderWidth =2.0f;
_myBotton.layer.borderColor = [[UIColor redColor]CGColor];
}

0 comments:

Post a Comment