1
votes

Summary : I tried to make some manual changes (increasing the font,width etc) in a css file stored in application support folder and saved it and when i am loading the corresponding page which has the link to that css i found that it did not reflect my changes in the CSS, and it would only reflect my changes when i killed the app and started it again.

I am working on an app where i am loading local stored HTML files into UIwebView by doing this

[[NSURLCache sharedURLCache] removeAllCachedResponses];
[self flushJavaScriptVariables];

[self.objwebview loadHTMLString:@"" baseURL:nil];

NSString *htmlfile = [HTML_SERVER_FILES stringByAppendingPathComponent:@"MyPage.html"];
NSURL *url = [NSURL fileURLWithPath:htmlfile];

 NSURLRequest *thereq = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:60];

[self.objwebview stringByEvaluatingJavaScriptFromString:@"document.open();document.close()"];

[self.objwebview loadRequest:thereq];

Also in the viewWillDisappear method i am doing this

-(void)viewWillDisappear:(BOOL)animated 
{
[super viewWillDisappear:animated];
[self.objwebview loadHTMLString:@"" baseURL:nil];
[self.objwebview setDelegate:nil];
[self.objwebview stopLoading];
[self.objwebview removeFromSuperview];
self.objwebview = nil;
}

Now at one point, if there are any changes i download the HTML files from the server and save them in the application support folder, but before saving those files i delete all the content from the folder where i am saving these updated files.

Now i am stuck at a place where when i download the new files from the server the changes from the new files are not reflected. The changes are only reflected when i terminate the app and restart my app.

Even if i change the padding or image in one HTML file or change the location of one control then too on getting the updated files from the server those changes are not reflected unless and until you kill the application and restart it again.

I want to skip the termination part so that my app directly loads the new changes from the stored files.

Please guide me out on that and let me know what needs to be done for the same.

Update: Code that i am using to save the files in the application support directory.

NSData *fileData = [NSData dataWithContentsOfURL:theFileURL];
            if (fileData.length!=0)
            {
                [fileData writeToFile:[HTML_SERVER_FILES stringByAppendingPathComponent:[dict valueForKey:@"FileName"]] atomically:YES];

                fileData = nil;

            }
1

1 Answers

0
votes

You need to perform clean your project after updating your HTML files. otherwise it will not be updated.