I want to copy cache data into database(sqlite/coreData) so that I can view while offline (without Internet) like " Reading List in Safari ". I read the code at Xcode UIWEBVIEW download , save HTML file and show which is following:-
- (void)viewDidLoad
{
NSURL *url = [NSURL URLWithString:@"http://livedemo00.template-help.com/wt_37587/index.html"];
//[WEBVIEW loadRequest:reqURL];
// Determile cache file path
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *filePath = [NSString stringWithFormat:@"%@/%@", [paths objectAtIndex:0],@"index.html"];
// Download and write to file
NSData *urlData = [NSData dataWithContentsOfURL:url];
[urlData writeToFile:filePath atomically:YES];
// Load file in UIWebView
[WEBVIEW loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:filePath]]];
[super viewDidLoad];
}
But the problem with this code is that it does not show up images while offline .
So I thought that saving Data from Cache to database could be another option.Can anyone share some sample code to copy the website content along with images to database.
Thank You in advance